Reference no: EM132410666
Parking lot Program - Inheritance
Write a complete C++ program with Inheritance.
Your program should achieve:
1. There are N parking Spaces in the Parking lot, each of which can be used for different types of vehicle (automobiles), including trucks, cars, and buses, but one parking space can hold 0 or 1 Car at a time. If there is no free parking space, a message will be displayed, and no parking space will be arranged for the vehicle.
2. The program simulates the parking situation of the vehicle: if there is space for the new vehicle, allocate the parking space for the vehicle in
order; Parking fee should be paid when the vehicle drives away.
3. The parking lot can display the license plate number of the currently parked vehicles and the current fees of all parking vehicle (income).
4. Defines Automobile base class as Automobile, including data member as license plate number (string).
5. Define the derived classes Truck, Car, Bus. In addition to having license plate numbers, these vehicles also have different attributes. Truck includes load-carrying properties (floating point number, unit: ton); Car also has a attribute as brand (string), and the Bus includes an authorized number of passengers (integer). In addition, each derived class implements the pay() function to display vehicle information and pay for parking. Here, Truck charges 3 dollar/time, Car charges 1 dollar/time, and Bus charges 2 dollar/time.