You are on page 1of 1

class comp():

def __init__(self, real, imag):


self.real = real
self.imag = imag
c1 = complex(real, imag)

def add(self, c1):


self.c1 = c1
#self.c2 = c2
result1 = self.real + c1.real
result2 = self.imag + c1.imag
#c1 = complex(real, imaginary)
#c2 = complex(real, imaginary)
print("Sum of the two Complex numbers :" + str(result1) + "+" +
str(result2) + "i")

def sub(self, c1):


self.c1 = c1
#self.c2 = c2
result1 = self.real - c1.real
result2 = self.imag - c1.imag
#c3 = complex(real, imaginary)
#c4 = complex(real, imaginary)
print("Subtraction of the two Complex numbers :" + str(result1) + "-" +
str(result2) + "i")

-----------------------------------------------------------------------------------
--------------------

class Movie():
def __init__(self, m_name, no_tick, total):
self.m_name = m_name
self.no_tick = no_tick
self.total = total

def __str__(self):
return "Movie : " + self.m_name + "\nNumber of Tickets : " +
str(self.no_tick) + "\nTotal Cost : " + str(self.total)

You might also like