Uploaded by Morgan Swaak

OOP 3

advertisement
Class Vehicle
{
public string Make {get; set;}
public string Model {get; set;}
public string EngineType {get; set;}
public int Year {get; set;}
public int Speed {get; set;}
public void start()
{
}
public void stop()
{
}
public void accelerate()
{
Speed++;
}
}
Class Car : Vehicle
{
public string BootType {get; set;}
public void openBoot()
{
Console.WriteLine( BootType + “ has opened”);
}
public void updateAttributes()
{
Console.WriteLine(“What is the Make”);
Make = Console.ReadLine();
Console.WriteLine(“What is the Model”);
Model = Console.ReadLine();
Console.WriteLine(“What is the Engine Type”);
EngineType = Console.ReadLine();
Console.WriteLine(“What is the Year”);
Year = Console.ReadLine();
Console.WriteLine(“What is the Speed”);
Speed = Console.ReadLine();
Console.WriteLine(“What is the Boot Type”);
BootType = Console.ReadLine();
}
public void displayAttributes()
{
Console.WriteLine(“Make = {0}, Model = {1}, Engine Type = {2}, Year = {3}, Speed = {4}, Boot
type = {5}” Make, Model, EngineType, Year, Speed, BootType)
}
}
Download