Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Databases With PostgreSQL From Novice To Professional

Authors: Richard Stones, Neil Matthew

2nd Edition

1590594789, 978-1590594780

More Books

Students also viewed these Databases questions

Question

List several examples of factory overhead.

Answered: 1 week ago