Question: the question should be written in Python Write a class called Shopping Cart that might be used in an online store. It should have the

the question should be written in Python

the question should be written in Python Write a class called Shopping

Write a class called Shopping Cart that might be used in an online store. It should have the following: A list of Item objects that represents the items in the shopping cart A constructor that creates an empty list of items (the constructor should take no arguments except self) A method called add() that takes a name and a price and adds an Item object with that name and price to the shopping cart A method called total) that takes no arguments and returns the total cost of the items in the cart A method called remove_items() that takes an item name a string) and removes any Item objects with that name from the shopping cart. It shouldn't return anything. A _str_0 method that returns a string containing info on all the items in the shopping cart Then test out the shopping cart as follows: (1) create a shopping cart called mycart. (2) add several items to it; (3) print the cart's total cost (using the total() method); (4) remove one of the items types; (5) print out the cart

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!