Question
Language: C++ In my main file (main.cpp), the code includes int main(){ Vehicle vehicles[] = { Vehicle(Toyota, Camry, 2010, 20000, 31000), ......}; Showroom showroom (Primary
Language: C++
In my main file (main.cpp), the code includes
int main(){
Vehicle vehicles[] = { Vehicle("Toyota", "Camry", 2010, 20000, 31000), ......};
Showroom showroom ("Primary" , 3);
showroom.AddVehicle(&vehicles[0]); showroom.AddVehicle(&vehicles[1]);
}
I already wrote the code for Vehicle.cpp and vehicle.h, now i need help writing the Showroom.cpp and showroom.h. The Showroom class has to store an array of Vehicle objects using dynamic memory allocation and needs to contain variables for the name of the showroom, a pointer to the array of vehicles, a maximum capacity of array, and count of how many vehicles it currently has. It also needs functions "void AddVehicle(const Vehicle *v);" to store vehicle in first available spot and "void ShowInventory() const;" to show the name and all of the vehicles in it. The accessors it should have are "const Vehicle *GetVehicleList() const;" , "unsigned int GetCapacity() const;" , "unsigned int GetCount() const;" , and "const char * GetName() const;"
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