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.
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;
}
Comments
Leave a comment