CSE111 Lab Assignment 7
CSE111 Lab Assignment 7
Task - 1
Given the following classes, write the code for the BBA_Student class so that the
following output is printed:
print(BBA_Student())
print(BBA_Student('Humpty Dumpty'))
print(BBA_Student('Little Bo Peep'))
Task – 2
print('Part 1')
print('------')
car = Vehicle()
print(car)
car.moveUp()
print(car)
car.moveLeft()
print(car)
car.moveDown()
print(car)
car.moveRight()
print(car)
print('------')
print('Part 2')
print('------')
car1 = Vehicle2010()
print(car1)
car1.moveLowerLeft()
print(car1)
car2 = Vehicle2010()
car2.moveLeft()
print(car1.equals(car2))
car2.moveDown()
print(car1.equals(car2))
A vehicle assumes that the whole world is a 2-dimensional graph paper. It maintains its
x and y coordinates (both are integers). The vehicle gets manufactured (constructed) at
(0, 0) coordinate.
Subtasks:
Note: All moves are 1 step. That means a single call to any move method changes
value of either x or y or both by 1.
Task - 3
Given the following classes, write the code for the Cricket_Tournament and the
Tennis_Tournment class so that the following output is printed.
class Printer:
def printSound(self, a):
print(a.makeSound())
d1 = Dog('bark')
c1 = Cat('meow')
a1 = Animal('Animal does not make sound')
pr = Printer()
pr.printSound(a1)
pr.printSound(c1)
pr.printSound(d1)
Task - 6
Given the following classes, write the code for the Triangle and the Trapezoid class so that
the following output is printed.
tri_default = triangle()
tri_default.calcArea()
print(tri_default.printDetail())
print('--------------------------')
tri = triangle('Triangle', 10, 5)
tri.calcArea()
print(tri.printDetail())
print('---------------------------')
trap = trapezoid('Trapezoid', 10, 6, 4)
trap.calcArea()
print(trap.printDetail())
Task - 7
Given the following classes, write the code for the Player and the Manager class so that the
following output is printed. To calculate the match earning use the following formula:
1. Player: (total_goal * 1000) + (total_match * 10)
2. Manager: match_win * 1000