Kamis, 21 Maret 2013

TUGAS OOPS


EXERCISE1
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
                      
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();

       }
}
Description: https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieCmG4HqQJgEXXy9HNru2fFk45ElRl5kIc667BBPLmObquWeqErAZb7nffNs_k5IFALbRwyjouAa0Qua2q1gcandmixYZhee1Fol0pk6GC17E_sWslNpdwxa3eL7cNT3WqdU3ilyEOq9ik/s320/1.png

EXERCISE2
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 players:");
                     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 as follows:");
                        Console.Write("First name: ");
                     Console.WriteLine(Fname);
                        Console.Write("Last name: ");
                     Console.WriteLine(Lname);
                        Console.Write("Number of players:");
                     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();
                     }
}

Description: https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsXLnH6B5XCbAz0i2pWA6uEDYvlUZEjvTIOqRc-X-35v6RSjg6E7i4mCjBPrZ9eEZnf72Mz1VlUZ9AnGeOoU1WntZf70ncxeXII6c0HF4BQJVeXfKYDJXhVIzZVI29fshkeQDWInkuvt1-/s320/2.png

EXERCISE3
using System;
class Myclass
{
       static void Main()
       {
              string Answer="Y";
              string Response_code="66";
              int Counter=60;
              Console.WriteLine(Answer);
              Console.WriteLine(Response_code);
              Console.WriteLine(Counter);
              Console.ReadLine();
       }
}

Description: https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj77uUcXFiACeyG8vlZqiA2I191MzllQyxuCVPoPAKIvfkPaS10Ng1dNABmk5qlUUA6xNUXDaxOd5A-U2Q3kRF8o3dKkd49rbKWWKAvrUJc2nFPhlseuK_toEhp8Uk4oLW20PUPJrJG6Ixl/s320/3.png

EXERCISE4
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 nymber 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.WriteLine("\n");
              Console.WriteLine(Car.Number_of_tyres);
              Console.WriteLine(" :is the number of wheels in a Car\n");
              Console.WriteLine(Motorcycle.Number_of_tyres);
              Console.WriteLine(" :is the number of wheels in a Motorcycle \n");
       }
}

Description: https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyJU2l5DS9bXk_LX_aVECkizC_X4NyL8CCrll8sfL0fEmZLX3oRGwMrj2DOXHq3tR729F3OOb0rMNse9WR5Q-Jf4s3bRoLhrdcAPbc9cujMrWPpYxfdShd45Rl-zJvxbyTpGWzDXLS7Qx_/s320/4.png

EXERCISE5
using System;
class Interchange
{
       int Top_score;
       int New_score;
       int Temp;
       void Swap()
       {
              Top_score=5;
              New_score=10;
              Temp=Top_score;
              New_score=Top_score;
              Top_score=New_score;
       }
       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);
       }
       static void Main()
       {
        Interchange I1=new Interchange ();
              I1.Swap();
              I1.Display();
       }
}
Description: https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_orr1Jcn_z-kGaq43NxFTVTG9j5bDCPCDlgKGTFjR5Qu0KV0LibHv7k1hyphenhyphen7RuOIjmiOCKKCY-KX_QWPkqXUyeHFNXkndpeA8_0JbbMwvKab8gtNjZFARTHyAyRSYxRi8dHxkMPKie6P-t/s320/5.png

EXERCISE6
using System;
class Library
{
    int ISBNNumber;
    string BookCategory;
    string Author;
    int NumberOfCopyAvailable;
    public void Borrowing_Book_Details()
    {
        Console.WriteLine("The 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("\n Enter ISBN Number:");
        ISBNNumber = Convert.ToInt32(Console.ReadLine());
        Console.WriteLine("Category of Books to be borrow (Fiction of 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 Imam
{
    public static void Main(string[] args)
    {
        Library L1 = new Library();
        L1.Get_Author_Details();
        L1.Borrowing_Book_Details();
        Console.ReadLine();
    }
}

Description: https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjX7RgAVRgAbABFcC_P3x4odRpG0xFcbmEqMDxwuN4aU9ZyWGyNZQY3v7o29udTL3s_mM_kilhi-RwG-Im71QUb1mmSdF6ds6FOSBH7OXpwZbC7eZgdKj4623SzYZ1yPvjX7J3rMAiFWVvG/s320/6.png