Question: Write the class LuxCar that inherits Car class. It should have a member variable called airCondSetting that is a positive integer value in the range
Write the class LuxCar that inherits Car class.
It should have a member variable called airCondSetting that is a positive integer value in the range 0 to 100.
It should have a display function that overrides the Car display function.
The display function must display all the information that Car objects display in addition to airCondSetting value.
You must call the display of the Car class inside the display of LuxCar.
Show the constructor of LuxCar when the Car class has the only Constructor of:
Car(int s = 100, int t = 10); //constructor
Test LuxCar and Car in Main.
In addition: Main program must create an array of pointer objects of type LuxCar and Car
Display all the Car and LuxCar using the Pointers.
This is to be written in C++
car.h
#ifndef Car_h #define Car_h class Car { private: int tank; int speed; static int count; public: //Car(); Default constructor //Car (int s, int t); Constructor with two arguments Car(int s = 100, int t = 10); //constructor with default argument void setTank(int t); int getTank(); void setSpeed(int t); int getSpeed(); static int getCount(); double pumpGas(int g); //3.25 per gallon -- max tank is 15 gallons void display() const;
};
#endif /* Car_h */
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
