Question: # Method: class Cart ( ) : def _ _ init _ _ ( self ) : self.cart = [ ] self.total = 0 def

# Method:
class Cart():
def __init__(self):
self.cart =[]
self.total =0
def add_to_cart(self, item):
self.cart.append(item)
self.total += item.price
The following class ```Cart``` and method ```add_to_cart``` are parts of a larger program used by a mobile phone company. The method ```add_to_cart``` will work when an object of type MobileDevice or of type ServiceContract is passed to it. State whether the method ```add_to_cart``` is a demonstration of the following items (yes/no) and the reasoning (1-2 sentences):
1. Inheritance
2. Polymorphism
3. Object-Oriented programming
4. Top-down design
5. Functional programming

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 Programming Questions!