Wednesday 24 April 2013

An automobile company has developed an application for maintaining the number of wheels in a vehicle. Predict the output of the following code of the application: 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.WriteLine("\n"); Console.Write (Car.Number_of_tyres); Console.WriteLine(" :is the number of wheels in a Car \n"); Console.Write (Motorcycle.Number_of_tyres); Console.WriteLine(" :is the number of wheels in a Motorcycle \n"); Console.ReadLine(); } } (Duration: 25 min)





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=Covert.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.Write(Car.Number_of_tyres);

 Console.WriteLine(" :is the number of wheels in a Car\n");

 Console.Write(Motorcycle.Number_of_tyres);

 Console.WriteLine(" :is the number of wheels in a Motorcycle \n");
  }
}
     








No comments:

Post a Comment