Consider a ShoppingCart
class that represents a shopping cart. It has an items
attribute to store the items in the cart and a total_price
method to calculate the total price of the items. You are given an Item
class that represents an item with a name and a price attribute. Your task is to complete the code by defining a singleton method on cart2
that applies a 20% tax to the total price. Modify the code above by adding the necessary code to define the singleton method on cart2
.