Simple car game

Leveling assignment for Object Oriented design

In this game there are parking garages where vehicles are parked. Parking garages can have more than one level. There are two kinds of vehicles, cars and police cars. The assignment is:

  • We want to represent a parking garage.
    • Each parking garage can have 1 or more levels
    • Each level can hold zero or more vehicles
    • Each level has a maximum height vehicle that it can handle
  • We want to represent vehicles
    • All individual vehicles can have: integer height (centimeters)
    • There are two types of vehicle, with slightly different properties
  • What classes do you need? Do you use inheritance?
  • There should be methods such as:
    • add_level() - allocates a level. Happens only once when the garage is first created.
    • count_regular_cars() - returns a count of how many regular cars there are in the garage
    • count_police_cars() - returns a count of how many police cars there are in the garage
    • car_arrives(vehicle, floor) - adds a vehicle to the specified floor
    • car_departs(vehicle) - removes a vehicle from the garage (assuming the car is there)
    • print_report() - shows how many floors the garage has and how many vehicles of what kind are on each level
  • Write a main program that:
    • Creates a garage with two levels
    • Creates 3 cars and one police car with different heights and statuses
    • Notes the arrival of all four vehicles
    • Prints a report of the current status of the garage