Question: In the VehicleManager class, implement a main method that displays a menu - driven UI to the user. Before the menu is displayed, vehicles should

In the VehicleManager class, implement a main method that displays a menu-driven UI to the user.
Before the menu is displayed, vehicles should be loaded from a file named vehicles.txt
The menu should present the following options:
View all vehicles in the system (User enters 1 and is shown a complete description of the vehicles in the system)
View vehicles by type (Car, Truck, Motorcycle)(User enters 2)
Add a new vehicle (User enters 3, then the type of Vehicle (Car, Truck, ..), then the subtype (Electric , or Fossil Fuel), then all the properties in the order of the class constructor )
Remove an existing vehicle (User enters 4, is presented with the list of vehicles, then enters the index of the vehicle to remove)
Display fuel efficiency and/or emissions for a vehicle (User enters 5)
Display fuel efficiency and/or emissions for a vehicle type (User enters 6, then the type of Vehicle (Car, Truck, ..))
Display fuel efficiency and/or emissions for all vehicles (User enters 7)
Exit the program (User enters Q)
Implement methods to handle each menu option, utilizing the classes you have created (Vehicle, VehicleList, VehicleFileManager, etc).
For the "Add a new vehicle" option, prompt the user to enter the necessary details and create an instance of the corresponding vehicle class. Add the new vehicle to the VehicleList.
For the "Remove an existing vehicle" option, display a list of all vehicles currently in the VehicleList and prompt the user to select a vehicle to remove.
For the "Calculate fuel efficiency" and "Calculate emissions" options, display a list of all vehicles currently in the VehicleList and prompt the user to select a vehicle. Then, calculate and display the fuel efficiency or emissions for the selected vehicle using the corresponding methods from the vehicle class.
For the "View all vehicles" option, display a list of all vehicles currently in the VehicleList, along with their types, fuel efficiency, and emissions.
For the "View vehicles by type" option, prompt the user to enter a vehicle type (e.g., "Car", "Truck", "Motorcycle") and display a list of vehicles of that type, along with their fuel efficiency and emissions.
The main method should continuously display the menu options to the user until the "Exit" option is selected (User enters Q). Before exiting vehicles are saved into the file vehicles.txt

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!