You
are required to design a software for a vehicle showroom to manage its
activities. Given the following requirements:
The showroom has a name, address
and sales tax number. The showroom sells cars and trucks. Car has a
manufacturer, model and number of doors, truck has a manufacturer, model and
loading capacity.
A base class vehicle with data members such as manufacturer and model. Two derived classes from the vehicle class, car with an additional data member number of doors, and truck, with additional data member loading capacity. A showroom class with data members name, address, and sales tax number. In addition, the showroom class will have cars and trucks.
class Vehicle{
protected:
string manufacturer, model;
public:
Vehicle(string mf, string mod): manufacturer(mf), model(mod){}
};
class Car: public Vehicle{
int number_of_doors;
public:
Car(string mf, string mod, int n): Vehicle(mf, mod), number_of_doors(n){}
};
class Truck: public Vehicle{
int loading_capacity;
public:
Truck(string mf, string mod, int n): Vehicle(mf, mod), loading_capacity(n){}
};
class Showroom{
string name, address;
int sales_tax_number;
Car *cars;
Truck *trucks;
public:
Showroom(string n, string ad, int st){
name = n;
address = ad;
sales_tax_number = st;
}
};
Comments
Dear Hunny, You're welcome. We are glad to be helpful. If you liked our service please press like-button beside answer field. Thank you!
Thank you! its really helpful.
Leave a comment