OOP Final Exam - Solution
OOP Final Exam - Solution
obj = Admin()
obj.display()
obj.check()
class ComputeArea(TriangleParam):
def __init__(self):
# Calling constructor of
# Base class
TriangleParam.__init__(self)
self.area=((self._height*self._base)/2)
print("Area of a Triangle: ",
self.area)
obj1 = ComputeArea()
obj2 = TriangleParam()
print("While, the Base has a value: ", obj2._base)
print("And, the Height has a value: ", obj2._height)
class Calculator:
def __init__(self, value1, value2):
self.fvalue = value1
self.svalue = value2
def info(self):
print("The first value:",self.fvalue)
print("The second value:",self.svalue)
def addition(self):
self.result=self.fvalue+self.svalue
print("The result:",self.result)
class Concatenation:
def __init__(self, fstring, sstring):
self.fstring = fstring
self.sstring = sstring
def info(self):
print("The first String:",self.fstring)
print("The second String:",self.sstring)
def addition(self):
self.concat=self.fstring+self.sstring
print("The result:",self.concat)