Car Class Code
Program:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CarClass
{
class Car
{
string Name;
string model;
string made;
string colour;
string EnginePower;
string AutoOrNon;
public void Data()
{
Console.WriteLine("Enter
Name of Car");
Name = Console.ReadLine();
Console.WriteLine("");
Console.WriteLine("ENter
model #");
model = Console.ReadLine();
Console.WriteLine("");
Console.WriteLine("made
by");
made = Console.ReadLine();
Console.WriteLine("");
Console.WriteLine("Enter
Colour");
colour = Console.ReadLine();
Console.WriteLine("");
Console.WriteLine("Power
in cyclic cylender CC ");
EnginePower = Console.ReadLine();
Console.WriteLine("");
Console.WriteLine("Automatic
or non-Automatic");
AutoOrNon = Console.ReadLine();
Console.WriteLine("");
}
public void Display()
{
Console.WriteLine(" Name: {0}", Name);
Console.WriteLine(" Model # is: {0}", model);
Console.WriteLine(" Company: {0}", made);
Console.WriteLine(" Colour: {0}",
colour);
Console.WriteLine(" Automatic/Manual?: {0}", AutoOrNon);
Console.WriteLine("Engine
power in Horse or CC: {0}", EnginePower);
}
}
class program1
{
static void Main(string[] args)
{
Car c1 = new Car();
c1.Data();
c1.Display();
}
}
}
Output:
No comments:
Post a Comment