Problem Statement

You are hired to develop a system that keeps track of all drivers and vehicles in a company. The company has many drivers and many different types of vehicles: bike, car, bus, truck, etc. A vehicle may have a driver assigned to it or no driver assigned to it. A driver is assigned to handle maximum one or no vehicle at a time. Sample attributes are listed below:

  • Vehicle: Vehicle number, type, capacity, driver assigned
  • Driver: driver id, name, vehicle assigned.

The system must be able to perform the following functions:

  • Create/Delete drivers and vehicles
  • Assign/Unassign a driver to/from a vehicle
  • List all drivers (all attributes must be shown)
  • List all vehicles (all attributes must be shown)
  • List all instances of a specified type of vehicle (all attributes of the instance must be shown)

Note that 2 marks is allocated for Composition. A sample code for composition is listed below: See image.

You are strongly advised to complete the assignment with composition but without inheritance and polymorphism before the mid trimester break, then convert the program to incorporate inheritance and polymorphism after the mid trimester break.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.