For this assignment you will create a program to support a small hardware store. Your program will be able to keep track of items in the inventory of the store, so that the owner knows the quantities of each item in stock.
To represent an item in your program, create a class named Item with the following fields:
Your program should provide the user (store owner) with a command line choice menu about possible actions that they can perform. The choices should be the following:
When the program first loads, it reads all the saved records (if any) from a file named database.txt into an ArrayList, and offers user 6 choices (listed on previous page).
The format of the contents of the database.txt file should be in human readable plain text, one record per line (note the ~ separator between different entries), e.g. While the program is running, the user can choose any of the 6 available options.
632VR~Nuts 1/2in~Fasteners~70~0.50
H43SM~Knobs 1-1/4in~Cabinet&Furniture~200~2.99
83RS9~Kwikset SmartLock~Door&Window~30~199.00
Selection options 2 or 3 changesArrayList not database.txt .
Selecting no 6 (exit) replaces entries in database.txt with new entries from ArrayList before exiting.
When the program first loads, it reads all the saved records (if any) from a file named database.txt into an ArrayList, and offers user 6 choices (listed on previous page). Selecting no 6 (exit) replaces entries in database.txt with new entries from ArrayList before exiting. The format of the contents of the database.txt file should be in human readable plain text, one record per line (note the ~ separator between different entries), e.g.
632VR~Nuts 1/2in~Fasteners~70~0.50
H43SM~Knobs 1-1/4in~Cabinet&Furniture~200~2.99
83RS9~Kwikset SmartLock~Door&Window~30~199.00
When displaying the items, print headers and format the data to line up in columns under the headers.
ID # | Name; | Category | Quantity | Price |
632VR | Nuts 1/2in | Fasteners | 70 | 0.50 |
H43SM | Knobs 1-1/14in | Cabinet and Furniture | 200 | 2.99 |
83RS9 | Kwikset Smartlock | Door and Window | 30 | 199.00 |
Price should be output showing two decimal digits: (e.g 99.95).
Be sure to validate the user input.
You don't need to create any GUI for this assignment. Command line operations are enough.