s = #of wicket * 1000 Century Bonus = #of century * 1000 addPlayerWithWickets and addPlayerWithCenturies methods should work any number of parameters assuming that the parameter number will be an even number and greater than 1.
write a python code and finish it within 20 minutes please
????????:
Design Australia class and England class which inherit from Cricket class
so that the following code provides the expected output.
Note:
Wicket Bonus = #of wicket * 1000
Century Bonus = #of century * 1000
addPlayerWithWickets and addPlayerWithCenturies methods should work any
number of parameters assuming that the parameter number will be an even
number and greater than 1.
class Cricket:
total_player = 0
def __init__(self, name, number):
self.name = name
self.number = number
def __str__(self):
s = "Name: "+self.name+", World Cup: "+self.number
return s
# Write your codes here.
# Do not change the following lines of code.
s1 = Australia("Australia", "5")
print("==============================")
s1.addPlayerWithWickets("Starc", 4, "Hazlewood", 3)
print("==============================")
print(s1)
print("==============================")
s2 = England("England", "1")
print("==============================")
s2.addPlayerWithCenturies("Root", 5, "Ali", 3, "Woakes", 3)
print("==============================")
print(s2)
print("==============================")
print("Total Players:", Cricket.total_player)
OUTPUT:
Australia has won world cups 5 time(s)
==============================
==============================
Name: Australia, World Cup: 5
Total Player(s): 2
Player Details:
Name: Starc, Wicket Bonus: 4000$
Name: Hazlewood, Wicket Bonus: 3000$
==============================
England has won world cups 1 time(s)
==============================
==============================
Name: England, World Cup: 1
Total Player(s): 3
Player Details:
Name: Root, Century Bonus: 5000$
Name: Ali, Century Bonus: 3000$
Name: Woakes, Century Bonus: 3000$
==============================
Total Players: 5
Step by step
Solved in 4 steps with 4 images