Answer to Question #186971 in C++ for hunny

Question #186971

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.

  •  Please decide which classes would be needed and what would be the relationship between those classes.
  •  Write the interface of the classes decided above .
1
Expert's answer
2021-04-29T03:15:36-0400

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;
        }
};

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

Assignment Expert
29.04.21, 13:05

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!

hunny
29.04.21, 13:04

Thank you! its really helpful.

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS