Task Description: Implement a Shopping Cart System in Python
You are required to implement a shopping cart system that allows users to add and remove items, view the total price of the cart, and clear the cart. This functionality must be implemented in the /app/ directory.
Requirements:
Class Structure:
Create a class named ShoppingCart.
Attributes:
The class should contain an attribute to store the items in the cart. This can be a list of dictionaries, where each dictionary contains:
item: A string representing the name of the item.
price: A float representing the price of the item.
quantity: An integer representing how many of this item are in the cart.
Methods:
Implement the following methods:
add_item(item: str, price: float, quantity: int): This method should add an item to the cart. If the item already exists, it should update the quantity.
remove_item(item: str): This method should remove an item from the cart completely.
view_cart(): This method should return a list of all items in the cart along with their prices and quantities.
get_total(): This method should return the total price of all items in the cart (quantity * price for each item).
clear_cart(): This method should remove all items from the cart.
Additional Constraints:
Ensure that when an item is added, the quantity should be greater than zero.
The price should be a non-negative number.
When removing an item, if the item does not exist in the cart, a message or error should be generated (handling could be done with exceptions).
Deliverables:
The implemented ShoppingCart class in a Python file named shopping_cart.py within the /app/ directory.
Ensure the implementation passes all the provided test cases when executed.
Make sure to write clean, readable code with appropriate comments and error handling where necessary.