Question: ( java ) Lab Assignment: Car Lot Inventory Management Program Objective: In this lab, you will create a program to manage the current inventory for
javaLab Assignment: Car Lot Inventory Management Program
Objective:
In this lab, you will create a program to manage the current inventory for a car lot using a Car class with specific attributes Make Model, Year, Price You will use an ArrayList to store Car objects with prepopulated data. The program will have functions to display the entire inventory of the car lot and calculate the total value of all cars in the inventory.
Preparation:
Create a Car class with the following attributes:
Make String: The make of the car eg Toyota, Honda, Ford
Model String: The model of the car eg Camry, Civic, Mustang
Year int: The manufacturing year of the car eg
Price double: The price of the car in USD eg
Create an ArrayList to store Car objects and prepopulate it with sample car data.
Functionality:
Display Entire Inventory:
Create a function named displayInventory that will display the entire inventory of the car lot.
The function will iterate through the ArrayList of Car objects and print the details of each car, including its Make, Model, Year, and Price.
The displayed data should be formatted in a clear and presentable manner, making use of formatting functions to enhance readability.
Calculate Total Value:
Create a function named calculateTotalValue in your main driver that will calculate and display the total value of all cars in the car lot's inventory.
The function will iterate through the ArrayList of Car objects, sum up the prices of all the cars, and display the total value.
The total value should be formatted to show the amount in with appropriate decimal places and separators eg
Program Execution:
Upon running the program, the inventory of the car lot, along with the total value of all cars, will be displayed automatically.
The data should be formatted in an organized and easytoread manner, enhancing the user experience.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
