This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Rabu, 20 Maret 2013

Exercise OOPS #2



Exercise 1
using System;
class Geometrical_Shapes
{
    double No_of_coordinates;
    double Area;
    string Color;

    public void Create()
    {
        Console.WriteLine("Enter Number of coordinates: ");
        No_of_coordinates = Convert.ToDouble(Console.ReadLine());
        Console.WriteLine("Enter the Area: ");
        Area = Convert.ToDouble(Console.ReadLine());
        Console.WriteLine("Enter the Color: ");
        Color = Console.ReadLine();

    }
    public void Display()
    {
        Console.WriteLine("THIS IS WHAT YOU ENTERED: \n");
        Console.Write("Number of coordinates: ");
        Console.WriteLine(No_of_coordinates);
        Console.Write("Area: ");
        Console.WriteLine(Area);
        Console.Write("Color: ");
        Console.WriteLine(Color);
    }
}
class Classy
{
    static void Main(String[] args)
    {
        Geometrical_Shapes Small_rectangle = new Geometrical_Shapes();
        Small_rectangle.Create();
        Small_rectangle.Display();
        Console.ReadLine();
    }
}



Exercise 2
using System;
class GameDetails
{
    string Fname;
    string Lname;
    int NoOfPlayers;
    int Level;

    public void Accept_game_details()
    {
        Console.WriteLine("Enter Your first Name:");
        Fname = Console.ReadLine();
        Console.WriteLine("Enter Your last Name:");
        Lname = Console.ReadLine();
        Console.WriteLine("Enter Number of Player:");
        NoOfPlayers = Convert.ToInt32(Console.ReadLine());
        Console.WriteLine("Enter complexity level number:");
        Level = Convert.ToInt32(Console.ReadLine());
    }
    public void Display_game_details()
    {
        Console.WriteLine("\nThe details entered are follows:");
        Console.Write("First name:");
        Console.WriteLine(Fname);
        Console.Write("Last name:");
        Console.WriteLine(Lname);
        Console.Write("Number of Player:");
        Console.WriteLine(NoOfPlayers);
        Console.Write("Level:");
        Console.WriteLine(Level);
    }
}

class my
{
    static void Main(string[] args)
    {
        GameDetails Bingo = new GameDetails();
        Bingo.Accept_game_details();
        Bingo.Display_game_details();
        Console.ReadLine();
    }
}


Exercise 3

using System;
class Myclass
{
    static void Main()
    {
        string Answer = "Y";
        string Respone_code = "66";
        int Counter = 60;

        Console.WriteLine(Answer);
        Console.WriteLine(Respone_code);
        Console.WriteLine(Counter);
        Console.ReadLine();
    }
}





Exercise 4

using System;
class Vehicle
{
    public int Number_of_tyres;
}

class MyVehicle
{
    static void Main(string[] args)
    {
        Vehicle Motorcycle = new Vehicle();
        Vehicle Car = new Vehicle();
        Console.WriteLine("Enter the number of wheels in a car:");
        Car.Number_of_tyres = Convert.ToInt32(Console.ReadLine());
        Console.WriteLine("Enter the number of wheels in a Motorcycle:");
        Motorcycle.Number_of_tyres = Convert.ToInt32(Console.ReadLine());
        Console.Write("\nThe number of wheels in a car is ");
        Console.WriteLine(Car.Number_of_tyres);
        Console.Write("The number of wheels in a Motorcycleis ");
        Console.WriteLine(Motorcycle.Number_of_tyres);
        Console.ReadLine();
    }
}





Exercise 5

using System;
class Interchange
{
    int Top_score;
    int New_score;
    int Temp;

    void Swap()
    {
        Top_score = 5;
        New_score = 10;
        Temp = Top_score;
        Top_score = New_score;
        New_score = Temp;
    }

    void Display()
    {
        Console.WriteLine("The new value of top score is:");
        Console.WriteLine(Top_score);
        Console.WriteLine("The old value of top score was:");
        Console.WriteLine(New_score);
        Console.ReadLine();
    }

    static void Main()
    {
        Interchange I1 = new Interchange();
        I1.Swap();
        I1.Display();
    }
}


Exercise 6
using System;
class Library
{
    int ISBNNumber;
    string BookCategory;
    string Author;
    int NumberOfCopyAvailable;

    public void Borrowing_Book_Details()
    {
        Console.WriteLine("\nThe Details of the Author Book:");
        Console.WriteLine("ISBN Number:");
        Console.WriteLine(ISBNNumber);
        Console.WriteLine("Book Category:");
        Console.WriteLine(BookCategory);
        Console.WriteLine("Author Name:");
        Console.WriteLine(Author);
        Console.WriteLine("Number of Copies Available:");
        Console.WriteLine(NumberOfCopyAvailable);
    }
    public void Get_Author_Details()
    {
        Console.WriteLine("Please, Enter the details of the Author");
        Console.WriteLine("\nEnter ISBN Number:");
        ISBNNumber = Convert.ToInt32(Console.ReadLine());
        Console.WriteLine("Book Category (Fiction or Nonfiction):");
        BookCategory = Console.ReadLine();
        Console.WriteLine("Enter Author Book Name:");
        Author = Console.ReadLine();
        Console.WriteLine("Number Of Copy Available:");
        NumberOfCopyAvailable = Convert.ToInt32(Console.ReadLine());
    }
}
class Lukni
{
    public static void Main(string[] args)
    {
        Library L1 = new Library();
        L1.Get_Author_Details();
        L1.Borrowing_Book_Details();
        Console.ReadLine();
    }
}