122k views
2 votes
Create, compile, and run a program that manages a linked list. Specifically, create a linked list for the rental agency’s inventory. Put at least 12 cars in the list. Print the list. Ask for a car by its location in the list. If the car is not in the inventory (list), just say so. If it is in the inventory, tell the car's make, model, VIN.

Data fields are: Make of car, model of car, VIN of car.
For this lab, you will need to use the files BagInterface.java, Item.java, and LinkedBag.java.
You should modify Item.java. Also, you should rename it. You can model your code on OnlineShopper.java.
You only need to submit any of those files if you change them.
Also, please submit a list of the car information as a text file along with your code.

User Sujan
by
8.9k points

1 Answer

4 votes

Final answer:

To manage a linked list for a rental agency's inventory, define data fields for each car, create a class for car objects, implement the linked list data structure, and populate it with at least 12 cars. Prompt the user for a car location and display the car's details if it exists in the inventory. Submit the code and car information as a text file.

Step-by-step explanation:

To create, compile, and run a program that manages a linked list for the rental agency's inventory, start by defining the necessary data fields for each car, such as the make, model, and VIN. Then, create a class for the car objects and implement the linked list data structure to store the cars. Populate the linked list with at least 12 cars, and print the list to verify the inventory.

To ask for a car by its location in the list, prompt the user to enter a number corresponding to the position of the car in the list. If the car is not in the inventory, display a message stating so. If it is in the inventory, retrieve the car object and print its make, model, and VIN.

Ensure that the program is compiled and run using the necessary files, such as BagInterface.java, Item.java (modified and renamed), and LinkedBag.java. Finally, submit the list of car information as a text file along with your code.

User Vittorio Cozzolino
by
7.7k points