In: Computer Science
1. Create a class named Mobile
2. Add IEMICode, processor, make, model and color properties to the Mobile class
3. Create a methods connectBlueTooth, sendMessage, changeColor, displayInfo in the class Mobile.
4. Write a python script that creates two instances of the class Mobile, changes their colors to Black and Pink and prints a message to the console to display the object attributes using the displayInfo method
5. Run the program and observe the message in Console
class Mobile:
def __init__(self,IEMICode,processor,make,model,color):
self.IEMICode=IEMICode
self.processor=processor
self.make=make
self.model=model
self.color=color
def connectBluetooth(self):
print("Bluetooth is connected")
def sendMessage(self):
print("send message")
def changeColor(self,c):
print("color is changed to:"+c)
self.color=c
print(self.color)
//display result
def displayInfo(self):
print("IEMICode:"+self.IEMICode)
print("processor:"+self.processor)
print("make:"+self.make)
print("model:"+self.model)
print("color:",self.color)
//object creation
object1=Mobile("123456789nkjd789","Apple A13 Bionic","make1","iphone 11","white")
object1.color="black"
print(object1.displayInfo())
print("-----------------second instances of mobile details:-------------------------")
object2=Mobile("123456789nkjd789","Apple A13 Bionic","make1","iphone 11","black")
object2.color="pink"
print(object2.displayInfo())