Shopping Cart Management System
You are tasked with developing a Shopping Cart Management System in C programming that allows
users to set the prices of items and manage their shopping cart.
Requirements:
1. User-Defined Item Prices:
o The system should prompt the user to input the prices for 3 different items:
§ Item 1: The user enters the price.
§ Item 2: The user enters the price.
§ Item 3: The user enters the price.
2. Menu Options: The system should display a menu with the following options:
o 1. Add Item: Allows the user to add an item to the shopping cart by selecting the item
number and entering the quantity.
o 2. Remove Item: Allows the user to remove an item from the shopping cart by selecting
the item number and entering the quantity to remove.
o 3. Display Total Cost: Displays the current total cost of all items in the shopping cart.
o 4. Exit: Exits the program.
3. Add Item to Cart:
o Prompt the user to select the item (1, 2, or 3) and the quantity to add.
o Validate that the quantity is a positive integer.
o Multiply the item’s price by the quantity and add the result to the total cost of the cart.
4. Remove Item from Cart:
o Prompt the user to select an item (1, 2, or 3) and the quantity to remove.
o Ensure that the user cannot remove more than what is currently in the cart (i.e., the total
cost cannot become negative after removal).
o If the removal would result in a negative total cost, deny the removal and display an
error message.
5. Display Total Cost:
o Calculate and display the current total cost of all items in the cart.
6. Control Flow:
o Use a switch-case structure to manage the menu options.
o Use a loop to continuously display the menu until the user chooses to exit.
7. Input Validation:
o Ensure that the user selects valid menu options (1-4).
o Ensure that the item quantities are valid (positive integers).
Submit a document that includes the C program for the Shopping Cart Management System
simulation, along with a minimum of five test cases.