Coding Exercise: List
Test your understanding about lists.
We'll cover the following
Problem
This activity uses a list
for a grocery-list program. Create a console application called Grocery List that meets the requirements below.
- Display the following:
Add/ Remove/ Display items from grocery list (Add/Remove/Display/Exit):
. - Allow a user to add or remove items from a grocery list.
- Allow a user to display all items on the grocery list.
- Repeat this, until the user selects
Exit
.
Sample input and output
The finished output of the program should look like the example below:
Grocery List
Add/Remove/Display items from grocery list (Add/Remove/Display/Exit): Add
What would you like to add? Chicken
Chicken has been added.
Add/Remove/Display items from grocery list (Add/Remove/Display/Exit): Add
What would you like to add? Fish
Fish has been added.
Add/Remove/Display items from grocery list (Add/Remove/Display/Exit): Display
Grocery List:
Chicken
Fish
Add/Remove/Display items from grocery list (Add/Remove/Display/Exit): Remove
What would you like to add? Chicken
Chicken has been removed.
Add/Remove/Display items from grocery list (Add/Remove/Display/Exit): Display
Grocery List:
Fish
Add/Remove/Display items from grocery list (Add/Remove/Display/Exit): Exit
Get hands-on with 1400+ tech skills courses.