Question: Objective: Develop a program that allows users to input inventory data. The program should continuously prompt the user to enter the name and price of
Objective:
Develop a program that allows users to input inventory data. The program should continuously prompt the user to enter the name and price of each item until they decide to stop. Once the data collection is complete, the program will display the complete inventory and total price of all items in the inventory list.
Requirements:
Class Inventory
Create a Class named Inventory
Define a private String variable for the item name.
Define a private double variable for the item price.
Implement a noargument constructor that initializes the item name to null and the price to
Implement a constructor that accepts parameters for both the item name and price.
Create accessor getter methods for both the item name and price.
Create mutator setter methods for both the item name and price.
Class Demo
Demonstrate the functionality of the Inventory class in a separate class called Demo.
Create an ArrayList to store instances of Inventory items.
Instantiate at least three Inventory objects and add them to the ArrayList.
Prompt the user to enter item names and prices, adding each item to the ArrayList until they choose to exit.
Implement a method to get the total price for all items in the Inventory
Display the price to the user
Input Validation
Implement functionality to allow users to input case insensitive values to quit the program
Output
Print the item names along with their corresponding prices.
Ensure that all prices item and total purchase price are displayed with two decimal places.
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
