Answer to Question #186967 in C++ for hunny

Question #186967

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:29-0400

Answer 1 :-

In this Scenario we used simple three base class .

1st class is Showroom and two other class is 1st Cars and 2nd Truck.


 #include <iostream> 
using namespace std;


class showroom{
    public:
        String name;
        String address;
        int sales_tax_number;
        void getdata(){
       	    cout << "\nEnter name of showroom\n"; 
       	    cin >>name;
       	    cout<<"Enter address of showroom\n";
       	    cin>> address;
       	    cout<<"Enter sales_tax_number";
       	    cin>>sales_tax_number;
 	}
};
class Cars{
    public:
        String manufacturer;
        int model;
        int doors;
        void getdata(){
            cout << "\nEnter manufacturer\n"; 
       	    cin >>manufacturer;
       	    cout<<"Enter model\n";
       	    cin>> model;
       	    cout<<"Enter no. of doors";
       	    cin>>doors;
        }
};
class truck{
    public:
        String manufacturer;
        int model;
        int loading_capacity;
        void getdata{
            cout << "Enter manufacturer\n"; 
       	    cin >>manufacturer;
       	    cout<<"Enter model\n";
       	    cin>> model;
       	    cout<<"Enter loading_capacity";
       	    cin>>loading_capacity;
        }
};
int main(){
    showroom obj1;
    Cars obj2;
    truck obj3;
    obj1.getdata();
    obj2.getdata();
    obj3.getdata();
    return 0;
}

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

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS