Write a C++ program that does the following:
Create a class called Automobile
This class has the following private attributes:
model
year
mileage
This class has the following methods:
Default constructor
Non-default constructor that will initialize all the above attributes
Set/Get method for each of the above attributes
displayAuto that will print the information for the Automobile all three attributes on the same line with proper spacing
Destructor method that will print a message that the object has been deleted
Create a class called Inventory
This class has the following private attributes:
count: This represents how many current automobiles in the inventory
maxCount: This represents the maximum number of automobiles that can be stored
autoPtr: A pointer to Automobile objects.
This class has the following methods:
Default constructor (count is 0, maxCount will be 10, autoPtr is NULL)
Non-default constructor that will have one integer parameter
count will be initialized to 0
maxCount will be set to that one parameter passed
autoPtr will be allocated enough space to accommodate enough objects equals to the maxCount. Basically, you will use the new operator to allocate space for an array of Automobile objects.
addAutombile to append a new automobile to the inventory and update all the needed attributes. This method needs to check to see that you have not exceeded the capacity of the inventory
displayInventory method that will call displayAuto method to display the content of the inventory
Destructor method to make sure everything is cleaned up especially the memory allocated for the pointer. Also display a message that you called the destructor of the Inventory class.
Your main function should do the following
Ask the user how many automobiles to create
Define the appropriate variables as needed
Create an Inventory object and call the non-default constructor for that object with the number of automobiles given by the user
Use a do..while loop to display the menu with the following options:
1: Add an automobile to the inventory
2: Display the content of the inventory
3: Display the automobiles below certain mileage
4: exit
Your code should ensure that user inputs a valid choice (1..4) only
If the user choses "1", this should call a function called addNewAuto. This function will take the Inventory object as a parameter and then call the addAutomobile method to add the new car
If the user choses "2", this should call the displayInventory method of the Inventory object
If the user choses "3", this should call a function called searchAuto. This function will take the Inventory object as a parameter and then ask the user for the mileage. Then it will display all automobiles in the inventory below that mileage.
If the user choses "4", the system will exit.