You have been hired by a car rental company to create a new piece of software to keep track of their rental car inventory. As a computer scientist, you know the importance of planning out the solution to a problem before beginning to write any code. Your application will keep track of the vehicles in the company's inventory.
The company stores all their data in a file on the institution's server. The file looks similar to the files that you have been working with for your assignments. Each line of data in the file contains information about an individual vehicle including the following information: vehicle ID, make, vehicle type, odometer reading, the cost to rent/day, number of times the vehicle has been rented and whether the vehicle is available to rent or currently in use.
Here's a copy of the CSV file that you can use: Vehicle Information
Please feel free to add more lines of data (in the same format as the provided lines) to the CSV file to test your program.
Your program will initially read the data from the file into an appropriate data structure (maybe a list of lists?). The filename will always be the same so it can be hard-coded into your program. All updates are made to this data structure - not to the text file.
Your program must include the following functionality:
Add New Vehicle: Your program should allow the user to add a new vehicle to the database. The user should be prompted for all required information: vehicle ID, make, vehicle type, odometer reading, the cost to rent/day, number of times the vehicle has been rented and whether the vehicle is available to rent or currently in use.
When the user is adding a new vehicle, your program should verify that the user enters a numerical value when specifying the vehicle ID, odometer reading, cost to rent and the number of times the vehicle has been rented. The newly added vehicle should be classified as being available to rent since it was just added into the inventory. If the user enters input of an invalid format, please print out a meaningful message telling the user what the problem is and re-prompt the user for valid input.
Update Vehicle Information: Your program should allow the user to make the following changes to the vehicle information:
- Update the Odometer Reading - Updates the recorded odometer reading for the vehicle.
- Update the Cost of the Vehicle - Updates the cost of renting the vehicle.
- Update the Rental Status of the Vehicle - Sets the vehicle as being available or not available.
- Remove a Vehicle - Removes a vehicle from the inventory catalogue given the vehicle ID.
You need to reflect on any changes related to the vehicle information directly within the data structure that you chose to use.
Display Vehicle Information: In addition, the company would like to be able to see a listing of all of the vehicles in their network.
- There should be an option to display the information for all vehicles in the system.
- There should be an option to list all vehicles by make, vehicle type or by availability.
- There should be an option to retrieve a list of vehicle IDs given the vehicle make.
- Keyword Search: The user should be able to enter any keywords (i.e. Corolla, Ford, ID #) and the program should display any cars in the inventory that match the keyword that was entered.
The user should have a choice to display the vehicle listing to the console or write the vehicle listing to a text file. If the user chooses to have the information written to a text file, your program should prompt them for the name of the file to which they wish to "write" the information.
Your program should allow the user to retrieve the following information for a vehicle and print out the information to the console:
Retrieve Information for a Specific Vehicle:
- Given the vehicle ID for a specific vehicle, there should be an option to retrieve the following information:
- Odometer reading
The interface will be menu-based with numbered items allowing the user to choose which functions they would like to do. Please ensure that your program is easy-to-use. The user interface should be designed in such a way that the TAs who are marking your assignment can understand and know how to use your program. For example, it should be straightforward for the TAs to add a new vehicle to the database and how to retrieve information about a specific vehicle based on the prompts provided in your program.
he program starts from here Task - Code: You are to write the code for the program that you planned out in the first part of the assignment.
Your program must be written in a modular format. You may, for example, have 4 modules; one for your user interface (this one will only really contain your main() method), one for file handling (such as reading the data from the text file and writing new information to the text file), one for the commands (such as updating vehicle database information and printing the information to the console) and a module for the database functionality (retrieving information for a specific vehicle in the inventory).