Coding Exercise: List

Test your understanding about lists.

Problem

This activity uses a list for a grocery-list program. Create a console application called Grocery List that meets the requirements below.

  1. Display the following: Add/ Remove/ Display items from grocery list (Add/Remove/Display/Exit):.
  2. Allow a user to add or remove items from a grocery list.
  3. Allow a user to display all items on the grocery list.
  4. 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.