Answered step by step
Verified Expert Solution
Question
1 Approved Answer
#include #include using namespace std; class Vehicle { private: std::string make; std::string model; unsigned int year; float price; unsigned int mileage; public: Vehicle ( )
#include
#include
using namespace std;
class Vehicle
private:
std::string make;
std::string model;
unsigned int year;
float price;
unsigned int mileage;
public:
Vehicle
make "COP;
model "Rust Bucket";
year ;
price ;
mileage ;
Vehiclestring make, string model, int year, float price, int mileage
thismake make;
thismodel model;
thisyear year;
thisprice price;
thismileage mileage;
void Display
cout year make model $ price mileage endl;
string GetYearMakeModel
string str tostringyear make model;
return str;
float GetPrice
return price;
;
#include "Vehicle.h
#include "Showroom.h
#include
#include
using namespace std;
int main
Initialize some data. It's hardcoded here, but this data could come from a file, database, etc
Vehicle vehicles
VehicleFord "Mustang",
VehicleMazdaCX
VehicleDodge "Charger",
VehicleTesla "Model S
VehicleToyota "Prius",
VehicleNissan "Leaf",
VehicleChevrolet "Volt",
;
Set the precision for showing prices with decimal places
cout std::fixed std::setprecision;
int testNum;
cin testNum;
if testNum
Showroom testShowroom;
testShowroom.ShowInventory;
else if testNum
Showroom oneSmall Showroom", ;
one.AddVehiclevehicles;
one.AddVehiclevehicles;
one.ShowInventory;
else if testNum
Showroom oneFull Showroom", ;
one.AddVehiclevehicles;
one.AddVehiclevehicles;
one.AddVehiclevehicles;
one.ShowInventory;
else if testNum
Showroom onePrice Test", ;
one.AddVehiclevehicles;
one.AddVehiclevehicles;
one.AddVehiclevehicles;
cout "Total value: $ one.GetInventoryValue;
else if testNum
Showroom oneRoom ;
one.AddVehiclevehicles;
one.AddVehiclevehicles;
one.AddVehiclevehicles;
cout "Total value: $ one.GetInventoryValue endl;
Showroom twoRoom ;
two.AddVehiclevehicles;
two.AddVehiclevehicles;
two.AddVehiclevehicles;
two.AddVehiclevehicles;
two.AddVehiclevehicles;
two.AddVehiclevehicles;
cout "Total value: $ two.GetInventoryValue;
return ;
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