Question: ( java ) Lab Assignment: Car Lot Inventory Management Program Objective: In this lab, you will create a program to manage the current inventory for

(java)Lab 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 5 Car objects with pre-populated 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 (e.g., Toyota, Honda, Ford).
Model (String): The model of the car (e.g., Camry, Civic, Mustang).
Year (int): The manufacturing year of the car (e.g.,2023,2022,2021).
Price (double): The price of the car in USD (e.g.,25000.00,35000.00,40000.00).
Create an ArrayList to store 5 Car objects and pre-populate 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 (e.g.,50,000.00).
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 easy-to-read manner, enhancing the user experience.

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 Programming Questions!