Getting Started
Make a java file with the name GroceryStoreExample. Import ArrayList and Scanner to the java file with these two lines at the top...
import java.util.ArrayList;
import java.util.Scanner;
What we want to do
We want to create a grocery list that has 4 simple commands. We want to be able to add items to the grocery list by simply typing the item name. We want to be able to remove items from the list by typing ‘remove’. We want to be able to clear every item from the list by typing ‘clear’. We want to be able to stop the program by typing ‘stop.’ Lastly we do not want any command to be case sensitive. Meaning that we should be able to type ‘sToP’ and the program should stop.
Here is what an example output should look like...
Enter an item, or type 'remove','clear','display, or 'stop' to stop adding to the list:
milk
Enter an item, or type 'remove','clear','display, or 'stop' to stop adding to the list:
eggs
Enter an item, or type 'remove','clear','display, or 'stop' to stop adding to the list:
cheese
Enter an item, or type 'remove','clear','display, or 'stop' to stop adding to the list:
corn
Enter an item, or type 'remove','clear','display, or 'stop' to stop adding to the list:
stop
These are the Items in your grocery list:
milk
eggs
cheese
corn
We should be able to display and remove an element from the list. As well as clear the list...
Enter an item, or type 'remove','clear','display, or 'stop' to stop adding to the list:
display
These are the items in your Grocery list:
milk
bread
cheese
Enter an item, or type 'remove','clear','display, or 'stop' to stop adding to the list:
remove
These are your items what would you like to remove:
milk
bread
cheese
I want to remove bread
Enter an item, or type 'remove','clear','display, or 'stop' to stop adding to the list:
display
These are the items in your Grocery list:
milk
cheese
Enter an item, or type 'remove','clear','display, or 'stop' to stop adding to the list:
clear
Enter an item, or type 'remove','clear','display, or 'stop' to stop adding to the list:
display
These are the items in your Grocery list:
Enter an item, or type 'remove','clear','display, or 'stop' to stop adding to the list:
Stop
These are the Items in your grocery list: