Question: 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

 Given Program C-2 which consists of three classes, Automobile, Car andTruck, respectively. An object is created from each class as shown inthe main function. 1 // Program C-2 2 3 #include 4 using

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 #include 4 using namespace std; 5 class Automobile 6 private: 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 3 18 19 void print () const! 20 cout doors = doora: 37 38 39 void print conat 40 41 cout the car has door doorn wheel Drive - wheelDrive; 57 ) 58 59 void print() const { 60 // The code for this method is for the question (e) 61 ) 62 63 64 65 66 67 68 int main() { Automobile automobile; Car car ("Ford", 2019, 150000); Truck truck; 70 71 72 73 74 75 76 car.print(); automobile.print(); automobile = car; automobile.print(); 77 return 0; 1 a. 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 automobile.print) 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: 50.000 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!