Task Description: Implement a Basic Shopping Cart Functionality
You need to implement a shopping cart system that allows users to add items, remove items, and view the total price of the cart. The implementation should adhere to the following requirements to ensure all provided tests pass:
Shopping Cart Class:
Create a class named ShoppingCart located in the /app/ directory.
Core Methods:
Implement the following methods within the ShoppingCart class:
add_item(item: str, price: float, quantity: int):
Adds the specified item to the cart.
item is a string representing the name of the item.
price is a float representing the price of a single item.
quantity is an integer indicating how many of this item to add.
If an item is added multiple times, it should update the quantity.
remove_item(item: str):
Removes the specified item from the cart.
If the item does not exist, this method should not throw an error.
get_total() -> float:
Returns the total price of all items in the cart, factoring in the quantity of each item.
Ensure that the total is calculated correctly as the sum of price multiplied by quantity for all items.
get_items() -> list:
Returns a list of tuples where each tuple contains the item name, its price, and quantity in the format: (item_name, price, quantity).
Initial State:
The cart should start as empty when the ShoppingCart class is instantiated.
Edge Cases:
Ensure that adding items with a quantity of 0 does not add them to the cart.
Ensure that attempting to remove an item that does not exist does not affect the current state of the cart.
Your implementation should be carefully tested to confirm that these specifications satisfy the requirements of the test code, ensuring a functional shopping cart system.