Question
A vehicle renting company offer different renting services at different rates to its customers. Using the class hierarchy provided in figure 1, implement a program
A vehicle renting company offer different renting services at different rates to its customers. Using the class hierarchy provided in figure 1, implement a program that fulfills the requirements provided below. Figure 1 Class hierarchy for the car rental appliaction Every vehicle that gets added to the system, should have a new ID. The ID is an integer that is incremented based on the previous largest ID. The four types of cars have their sale and rent prices. These prices include their respective taxes. Every time a new car is aquired by the company its ID should be added to the companys available vehicles. The record of available vehicles is an array of data structures of your choice. This array should be dynamically created within the class Accounting after asking the user how many vehicle he expects to have. When a vehicle is sold it should be removed from this array. When it gets rented, you should change the vehicle status within the chosen data structure stored within the array. Within the class Accounting, you should also have a function called getTotalRents() that traverses the records of vehicles from the vehicle class and calculates and returns the total net rent of the currently rented cars (as indicated by their status). The net rent of a car is the actual rent (what the customer) minus the tax. The classes Sedan, SUV, LightTruck, MediumTruck and HeavyTruck should have their own parametrized and default constructors. You also should implement a copy constructor for the class Sedan. Thse classes should have their own versions of getRent() as explained below. They also have each a variable called bonus whose default values are provided below. The classes passenger, vehicle, and truck have a variable called rentTax whose default variables are provided below. Every rented vehicle should have its own rent value that you need to store in the right class. You should also implment an overloaded assignment operator for the class Sedan. An appropriate constructor and destructor should be also created in the clas Vehicle. The function getRent() will calculate the rent as follows: (rent * rentPeriod) + RENT_TAX (Bonus * rentPeriod) The RENT_TAX is: 10USD for the trucks and 5USD for a passenger vehicle. Bonus for a sedan is 1.5, SUV, light truck is 2, medium truck is 2.5 and for a heavy truck is 3. The getBonus() function should return the bonus* period
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