Question
#include using namespace std; class vehicle { private: int age; float price; public: vehicle() { age = 0; price = 0; } void setage(int agehold)
#include
using namespace std;
class vehicle {
private:
int age;
float price;
public:
vehicle() { age = 0; price = 0; }
void setage(int agehold) { age = agehold; }
void setprice(float pricehold) { price = pricehold; }
int getage() { return age; }
float getprice() { return price; }
};
class car :public vehicle
{
private:
bool raceCarStatus;
public:
car() { raceCarStatus = false; }
void setRaceCarStatus(bool race) { raceCarStatus = race;}
bool getRaceCarStatus() { return raceCarStatus; }
};
class truck:public vehicle
{
private:
bool dieselTypeStatus;
public:
truck() { dieselTypeStatus = false; }
void setDieselTypeStatus(bool status) { dieselTypeStatus = status; }
bool getDieselTypeStatus() { return dieselTypeStatus; }
};
int main()
{
vehicle v;
v.setage(5);
v.setprice(95.32);
cout<<"vehicle age is "< cout << "vehicle price is " << v.getprice() << endl; car c; c.setage(532); c.setprice(4932.02); c.setRaceCarStatus(false); cout << "age of the CAR: " < cout << "price of the CAR: " << c.getprice()< cout << "racecar status(1 for yes 0 for no): " << c.getRaceCarStatus() << endl; truck t; t.setage(53342); t.setprice(124932.02); t.setDieselTypeStatus(true); cout << "age of the TRUCK: " << t.getage() << endl; cout << "price of the TRUCK: " << t.getprice() << endl; cout << "diesel fuel status(1 for yes 0 for no): " << t.getDieselTypeStatus() << endl; system("pause"); return 0; } 1.) Draw three UML class diagrams, one for each of the classes mentioned above 2.) Draw a generalization among the three class diagrams, showing the inheritance relationship. 3.) turn this code into pseudocode
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started