Question: please use C++ OOP Given Program C-2 which consists of three classes, Automobile, Car and Truck, respectively. An object is created from each class as

 please use C++ OOP Given Program C-2 which consists of threeclasses, Automobile, Car and Truck, respectively. An object is created from eachclass as shown in the main function, 1 // Program c-2 2

please use C++ OOP

Given Program C-2 which consists of three classes, Automobile, Car and Truck, respectively. An object is created from each class as shown in the main function, 1 // Program c-2 2 3 finclude using namespace std; 5 class Automobile{ 6 private: 7 string make; 8 protected: 9 int model; 10 11 public: 12 int price; 13 Automobile (string make = "", int model = 0, int price = 0) { 14 this->make = make; 15 this->model = model; 16 this->price = price; 17 } 18 19 void print () const { 20 cout door9 = doors; 37 39 39 void printo const 40 2 cout wheelDrive = wheelDrive; 57 } 58 59 void print() constf // The code for this method is for the question (c) } mer 63 64 int main() { 65 Automobile automobile; 66 Car car ("Ford", 2019, 150000); 67 Truck truck; 68 69 car.print(); 70 71 automobile.print(); 72 73 automobile = car; 74 automobile.print(); 75 return 0; What will the program print at each of the following lines? i. Line 69: car.print(); ii. Line 71: automobile.print ; iii. Line 73-74 automobile Cari automobile.print a (4 marks) b. Determine whether methods in class Car can access to the following attributes (or member variables). Write Yes if so, and No if otherwise. i. make ii. model iii. price iv. doors V. wheel Drive (5 marks) c. Complete the code for the method print () of class Truck. This method prints the detailed information about the truck including the make, model, price, number doors and type of wheel drive. The output should look like below: General Information Make : Ford Model: 2019 Price: 50000 This car is a 4WD truck The car has 4 doors. (6 marks)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!