Question
When submitting this lab, submit a .java file called ShoppingList1, and create the following structure in Eclipse: Package Name: week9 Class Name: ShoppingList1 For this
When submitting this lab, submit a .java file called ShoppingList1, and create the following structure in Eclipse: Package Name: week9 Class Name: ShoppingList1 For this lab you will need to download the starter code ShoppingList1.java. This file contains code written by another person. You must extend this code without changing any of the existing code. Be sure to update the header with your name. Shopping List The starter code contains a menu system for a shopping list application. The main() method has been written and should not be modified in any way. The main() method displays a menu to the user and asks them to select an action. Each one of the actions will call a method that you will write. The method definition headers have already been included in the starter code. Each method has a detailed description of the needed functionality. Your job is to read the description for each method and write the code to make them work. The program utilizes an ArrayList Add Items Delete Items Show Items Sort Items
|
Example Run
1. Add Items 2. Delete Items 3. Show Items 4. Sort Items 5. Exit Please enter a command: 1 Add an item to the list (or just hit 'ENTER' when done): Oranges 'Oranges' has been added to the Shopping List. Add an item to the list (or just hit 'ENTER' when done): Eggs 'Eggs' has been added to the Shopping List. Add an item to the list (or just hit 'ENTER' when done): Apples 'Apples' has been added to the Shopping List. Add an item to the list (or just hit 'ENTER' when done): 3 items have been added to your Shopping List. 1. Add Items 2. Delete Items 3. Show Items 4. Sort Items 5. Exit Please enter a command: 3 The Shopping List contains the following items: [Oranges, Eggs, Apples] 1. Add Items 2. Delete Items 3. Show Items 4. Sort Items 5. Exit Please enter a command: 1 Add an item to the list (or just hit 'ENTER' when done): Pears 'Pears' has been added to the Shopping List. Add an item to the list (or just hit 'ENTER' when done): Grapes 'Grapes' has been added to the Shopping List. Add an item to the list (or just hit 'ENTER' when done): 2 items have been added to your Shopping List. 1. Add Items 2. Delete Items 3. Show Items 4. Sort Items 5. Exit Please enter a command: 3 The Shopping List contains the following items: [Oranges, Eggs, Apples, Pears, Grapes] 1. Add Items 2. Delete Items 3. Show Items 4. Sort Items 5. Exit Please enter a command: 2 Delete an item from the list (or just hit 'ENTER' when done): Pizza Invalid Response! 'Pizza' is NOT an item in the list. The Shopping List contains the following items: [Oranges, Eggs, Apples, Pears, Grapes] Delete an item from the list (or just hit 'ENTER' when done): Pears 'Pears' has been deleted from the Shopping List. Delete an item from the list (or just hit 'ENTER' when done): 1 items have been deleted from your Shopping List. 1. Add Items 2. Delete Items 3. Show Items 4. Sort Items 5. Exit Please enter a command: 3 The Shopping List contains the following items: [Oranges, Eggs, Apples, Grapes] 1. Add Items 2. Delete Items 3. Show Items 4. Sort Items 5. Exit Please enter a command: 4 The Shopping List has been sorted. The Shopping List contains the following items: [Apples, Eggs, Grapes, Oranges] 1. Add Items 2. Delete Items 3. Show Items 4. Sort Items 5. Exit Please enter a command: 5 Goodbye |
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