Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ QUESTIONS PLS ANSWER ASAP c2.pdf C Given Program C-2 which consists of three classes, Automobile, Car and Truck, respectively. An object is created from

C++ QUESTIONS PLS ANSWER ASAP
image text in transcribed
image text in transcribed
image text in transcribed
c2.pdf C 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. // Program 0-2 3 Sinclude using namespace std; Salass Automobile! privater string makes e protected: 9 int model: 10 public: 12 int price; 13 Automobile{atring make int model = 0, int price = 0! 14 this-make = make) this->model = model; thin->price - price; 1 19 20 veid print 1) conat cout dor do 1 road sin const that has a door nal: 1 15 alas. Truck privato Car 46 protected: 47 int wheel Drive; //22WD or 4: 4WD 48 19 public: 50 Truck (string make = "Toyota", 51 int model = 2021, 52 double price = 30000, 53 int doors = 4, 54 int wheel Drive = 4) : Car(make, model, price, doors) 55 56 this->wheel Drive wheelDrive: 57 58 59 void print () const 60 // The code for this method is for the question (c) 61 62 62 65 int main() Automobile automobile Car car("Ford", 2019, 150000); Truck truck 68 car.printo automobile.print(); 72 73 automobile - cas; automobile.print 75 76 77 return 07 ) What will the program print at each of the following lines? T. Line 69. Car.int i Line automobil print in. Ling 73.74 ana ch 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 Y. 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 cats a 4w truck The car has 4 doors to marks

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 31st International Conference Dexa 2020 Bratislava Slovakia September 14 17 2020 Proceedings Part 1 Lncs 12391

Authors: Sven Hartmann ,Josef Kung ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

303059002X, 978-3030590024

More Books

Students also viewed these Databases questions

Question

=+ Are there additional forms of employee representation?

Answered: 1 week ago