C Assignment I
C Assignment I
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:
o The system should prompt the user to input the prices for 3 different items:
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 Prompt the user to select the item (1, 2, or 3) and the quantity to add.
o Multiply the item’s price by the quantity and add the result to the total cost of the 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 loop to continuously display the menu until the user chooses to exit.
7. Input Validation:
Submit a document that includes the C program for the Shopping Cart Management System