Page 1 of 1

When submitting this lab, submit a .java file called ShoppingList4, and create the following structure in Eclipse: For t

Posted: Fri Jul 08, 2022 6:15 am
by answerhappygod
When submitting this lab, submit a .java file calledShoppingList4, and create the following structure in Eclipse:
For this assignment you will be adding an important function tothe shopping list you created earlier in the course; Open List.
When the user selects Open List from the menu, the program willask if they are sure they want to overwrite the current shoppinglist being edited with the file on the fixed storage device andvalidate that the user responds with a Y or N.
Technical Design
Main()
openList(Scanner, shoppingList, FILENAME):
This function will return the shopping list (original orOpened) back to main().
Example Run
1. Add Items
2. Delete Items3. Show Items4. Sort Items5. Save List6. Open List7. ExitPlease enter a command: TerminateInvalid response. Please enter a choice from the menu(1-7).
1. Add Items2. Delete Items3. Show Items4. Sort Items5. Save List6. Open List7. ExitPlease enter a command: 6Are you sure you wish to overwrite your current shopping listwith the 'Shopping List.txt' file? (Y/N)sureInvalid response. Please answer with a 'Y' or 'N'Are you sure you wish to overwrite your current shopping listwith the 'Shopping List.txt' file? (Y/N)y
File Error: File 'Shopping List.txt' not found! Please savethe list before trying to open it.
1. Add Items2. Delete Items3. Show Items4. Sort Items5. Save List6. Open List7. ExitPlease enter a command: 1
Add an item to the list (or just hit 'ENTER' when done):Apples:6'Apples:6' has been added to the Shopping List.
Add an item to the list (or just hit 'ENTER' whendone):1 items have been added to your Shopping List.
1. Add Items2. Delete Items3. Show Items4. Sort Items5. Save List6. Open List7. ExitPlease enter a command: 5Are you sure you wish to overwrite the 'Shopping List.txt' filewith your current list? (Y/N)nShopping List not saved.
1. Add Items2. Delete Items3. Show Items4. Sort Items5. Save List6. Open List7. ExitPlease enter a command: 5Are you sure you wish to overwrite the 'Shopping List.txt' filewith your current list? (Y/N)yShopping List saved to file: Shopping List.txt.
1. Add Items2. Delete Items3. Show Items4. Sort Items5. Save List6. Open List7. ExitPlease enter a command: 1
Add an item to the list (or just hit 'ENTER' when done):Oranges:4'Oranges:4' has been added to the Shopping List.
Add an item to the list (or just hit 'ENTER' whendone):1 items have been added to your Shopping List.
1. Add Items2. Delete Items3. Show Items4. Sort Items5. Save List6. Open List7. ExitPlease enter a command: 3
---------------------Shopping List---------------------Apples 6Oranges 4---------------------
1. Add Items2. Delete Items3. Show Items4. Sort Items5. Save List6. Open List7. ExitPlease enter a command: 6Are you sure you wish to overwrite your current shopping listwith the 'Shopping List.txt' file? (Y/N)nShopping List not opened.
1. Add Items2. Delete Items3. Show Items4. Sort Items5. Save List6. Open List7. ExitPlease enter a command: 3
---------------------Shopping List---------------------Apples 6Oranges 4---------------------
1. Add Items2. Delete Items3. Show Items4. Sort Items5. Save List6. Open List7. ExitPlease enter a command: 6Are you sure you wish to overwrite your current shopping listwith the 'Shopping List.txt' file? (Y/N)yShopping List overwritten from file: ShoppingList.txt.
1. Add Items2. Delete Items3. Show Items4. Sort Items5. Save List6. Open List7. ExitPlease enter a command: 3
---------------------Shopping List---------------------Apples 6---------------------
1. Add Items2. Delete Items3. Show Items4. Sort Items5. Save List6. Open List7. ExitPlease enter a command: 7
Goodbye