Hello, can anyone help me with this program please? I need it in C++. I already have a bit of code that was given to me but I'm not sure how to go forward with it. Please help me. Modify the vehicle management program to allow an automobile rental company to manage its fleet of automobiles. First, define a class called CityCar that contains an array of pointers to the 100 objects in the Car class. This also allows you to store pointers to objects of the derived class types PassCar and Truck. The objects themselves will be created dynamically at runtime. Define a class CityCar with an array of pointers to the Car class and an int variable for the current number of elements in the array. The constructor will set the current number of array elements to 0. The destructor must release memory allocated dynamically for the remaining objects. Make sure that you use a virtual destructor definition in the base class Car to allow correct releasing of memory for trucks and passenger vehicles. Implement two versions of the insert() method using the prototype shown opposite. Each version will allocate memory to an object of the appropriate type-that is of the PassCar or Truck class-and use the arguments passed to it for initialization. The method should return false if it is impossible to enter another automobile (that is, if the array is full), and true in all other cases. The display() method outputs the data of all vehicles on screen. To perform this task it calls the existing display() method for each object. Create a new function called menu() and store this function in a new source file. The function will display the menu shown opposite, read, and return the user's choice. Additionally, write two functions, getPassCar() and getTruck(), which read the data for a car or a truck from the keyboard and write the data into the appropriate arguments. Create an object of the CityCar type in your main function. Insert one car and one truck. These will be the first vehicles of the company's fleet. If a user chooses "Add car" or "Add truck,” your program must read the data supplied and call the appropriate version of insert().

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter12: Points, Classes, Virtual Functions And Abstract Classes
Section: Chapter Questions
Problem 33SA
icon
Related questions
Question
Hello, can anyone help me with this program please? I need it in C++.
I already have a bit of code that was given to me but I'm not sure how to go forward with it. Please help me.
Modify the vehicle management program to allow an automobile rental company to manage its fleet of automobiles.
First, define a class called CityCar that contains an array of pointers to the 100 objects in the Car class.
This also allows you to store pointers to objects of the derived class types PassCar and Truck. The objects
themselves will be created dynamically at runtime.
Define a class CityCar with an array of pointers to the Car class and an
int variable for the current number of elements in the array. The constructor will set the current number of
array elements to 0. The destructor must release memory allocated dynamically for the remaining objects.
Make sure that you use a virtual destructor definition in the base class Car to allow correct releasing of
memory for trucks and passenger vehicles.
Implement two versions of the insert() method using the prototype shown opposite. Each version will allocate
memory to an object of the appropriate type-that is of the PassCar or Truck class-and use the arguments passed
to it for initialization. The method should return false if it is impossible to enter another automobile
(that is, if the array is full), and true in all other cases.
The display() method outputs the data of all vehicles on screen. To
perform this task it calls the existing display() method for each object.
Create a new function called menu() and store this function in a new source file. The function will display
the menu shown opposite, read, and return the user's choice.
Additionally, write two functions, getPassCar() and getTruck(), which read the data for a car or a truck from
the keyboard and write the data into the appropriate arguments.
Create an object of the CityCar type in your main function. Insert one car and one truck. These will be the
first vehicles of the company's fleet. If a user chooses "Add car" or "Add truck," your program must read
| the data supplied and call the appropriate version of insert().
Transcribed Image Text:Hello, can anyone help me with this program please? I need it in C++. I already have a bit of code that was given to me but I'm not sure how to go forward with it. Please help me. Modify the vehicle management program to allow an automobile rental company to manage its fleet of automobiles. First, define a class called CityCar that contains an array of pointers to the 100 objects in the Car class. This also allows you to store pointers to objects of the derived class types PassCar and Truck. The objects themselves will be created dynamically at runtime. Define a class CityCar with an array of pointers to the Car class and an int variable for the current number of elements in the array. The constructor will set the current number of array elements to 0. The destructor must release memory allocated dynamically for the remaining objects. Make sure that you use a virtual destructor definition in the base class Car to allow correct releasing of memory for trucks and passenger vehicles. Implement two versions of the insert() method using the prototype shown opposite. Each version will allocate memory to an object of the appropriate type-that is of the PassCar or Truck class-and use the arguments passed to it for initialization. The method should return false if it is impossible to enter another automobile (that is, if the array is full), and true in all other cases. The display() method outputs the data of all vehicles on screen. To perform this task it calls the existing display() method for each object. Create a new function called menu() and store this function in a new source file. The function will display the menu shown opposite, read, and return the user's choice. Additionally, write two functions, getPassCar() and getTruck(), which read the data for a car or a truck from the keyboard and write the data into the appropriate arguments. Create an object of the CityCar type in your main function. Insert one car and one truck. These will be the first vehicles of the company's fleet. If a user chooses "Add car" or "Add truck," your program must read | the data supplied and call the appropriate version of insert().
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 6 images

Blurred answer
Knowledge Booster
Concept of pointer parameter
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning