Write a console-based C# app that uses the concept ofinheritance to model motor vehicles as follows:1. Define an abstract class named MotorVehicles that has the following fourabstract methods:a. void driveForward()b. void stop()c. void driveBackward()d. void turn(string direction)2. This abstract class should:• have the following properties:o make (string)o model (string)o year (int)o weight (float or double)• have a default constructor• have a 4-argument constructor• should override the Equal() methodo Two MotorVehicle objects are equal if and only if they have thesame make, the same model, the same year, and the sameweight• should override the toString() method3. Derive the following 2 subclasses from the MotorVehicle class:a. A class named Truck. This class shouldi. have the following property• cargo_bed_size (float or double)ii. a constructor that conforms to the rules of constructors in thecontext of inheritanceiii. a method named printTruck() that just prints “This is a Truckobject”iv. overridden methods for the 4 methods in the abstract parentclass• The method implementations should just print simplemessages that have the word Truckv. should override the Equal() method• Two Truck objects are equal if and only if they have thesame properties as in the parent class plus the samecargo_bed_sizevi. should override the toString() methodPage 4 of 4b. A class named SportsCar. This class shouldi. have the following property• zero_to_60_time (float or double) [this is measure ofhow fast a car accelerates]ii. a constructor that conforms to the rules of constructors in thecontext of inheritanceiii. a method named printSportsCar() that just prints “This is aSportsCar object”iv. overridden methods for the 4 methods in the abstract parentclass• The method implementations should just print simplemessages that have the word SportsCar.v. should override the Equal() method• Two SportsCar objects are equal if and only if they havethe same properties as in the parent class plus the samezero_to_60_timevi. should override the toString() method
Write a console-based C# app that uses the concept of
inheritance to model motor vehicles as follows:
1. Define an abstract class named MotorVehicles that has the following four
abstract methods:
a. void driveForward()
b. void stop()
c. void driveBackward()
d. void turn(string direction)
2. This abstract class should:
• have the following properties:
o make (string)
o model (string)
o year (int)
o weight (float or double)
• have a default constructor
• have a 4-argument constructor
• should override the Equal() method
o Two MotorVehicle objects are equal if and only if they have the
same make, the same model, the same year, and the same
weight
• should override the toString() method
3. Derive the following 2 subclasses from the MotorVehicle class:
a. A class named Truck. This class should
i. have the following property
• cargo_bed_size (float or double)
ii. a constructor that conforms to the rules of constructors in the
context of inheritance
iii. a method named printTruck() that just prints “This is a Truck
object”
iv. overridden methods for the 4 methods in the abstract parent
class
• The method implementations should just print simple
messages that have the word Truck
v. should override the Equal() method
• Two Truck objects are equal if and only if they have the
same properties as in the parent class plus the same
cargo_bed_size
vi. should override the toString() method
Page 4 of 4
b. A class named SportsCar. This class should
i. have the following property
• zero_to_60_time (float or double) [this is measure of
how fast a car accelerates]
ii. a constructor that conforms to the rules of constructors in the
context of inheritance
iii. a method named printSportsCar() that just prints “This is a
SportsCar object”
iv. overridden methods for the 4 methods in the abstract parent
class
• The method implementations should just print simple
messages that have the word SportsCar.
v. should override the Equal() method
• Two SportsCar objects are equal if and only if they have
the same properties as in the parent class plus the same
zero_to_60_time
vi. should override the toString() method
Unlock instant AI solutions
Tap the button
to generate a solution