Question
Language: Java 1. Create a Product class with the following attributes and methods: - int: price - int: count - String: name - Constructor, accessors,
Language: Java
1. Create a Product class with the following attributes and methods:
- int: price
- int: count
- String: name
- Constructor, accessors, mutators, and toString.
2. Create an Inventory class as a driver with the following functionalities:
A text file named Products.txt for storing the Products.
Each line contains information of one product with the following format:
- Name : price : count
The program shows the following menu to the user:
- 1: add items
Ask the user to enter the products. Once the user entered all products, write the Inventory into the Products.txt with the given format.
- 2: show Inventory
Read the Inventory information from the Products.txt file into an array of Products and print the Inventory information on the screen.
- 0: exit
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started