@@ -3,33 +3,43 @@ class SportsMan(object):
3
3
pay_raise_index = 1.5
4
4
5
5
def __init__ (self , fname , lname , salary ):
6
+ """Initializes the parent class, SportsMan"""
6
7
self ._fname = fname
7
8
self ._lname = lname
8
9
self ._salary = salary
9
10
10
11
def fullname (self ):
12
+ """Returns a sports man's full name"""
11
13
return self ._fname + ' ' + self ._lname
12
14
13
15
def pay_raise (self ):
16
+ """Calculates a sports man's salary"""
14
17
self ._salary *= self .pay_raise_index
15
18
return self ._salary
16
19
17
20
18
21
class Player (SportsMan ):
19
22
"""This is a child class which inherits from SportsMan"""
23
+ # A specific pay_rise_index for class player
20
24
pay_raise_index = 2.0
21
25
22
26
def __init__ (self , fname , lname , salary , skillset = None ):
27
+ """Initializes class Player"""
28
+ # attributes fname, lname, salary are superclass attributes
23
29
super (Player , self ).__init__ (fname , lname , salary )
24
30
self ._skillset = skillset
25
31
26
32
27
33
class Coach (SportsMan ):
28
34
"""A second class inheriting from SportsMan"""
35
+ # a specific pay_rise_index for class coach
29
36
pay_raise_index = 2.4
30
37
31
38
def __init__ (self , fname , lname , salary , players = None ):
39
+ """Initializes the class Coach"""
40
+ # attributes fname, lname, salary superclass attributes
32
41
super (Coach , self ).__init__ (fname , lname , salary )
33
42
if players is None :
43
+ # return an empty list if coach has no players
34
44
self ._players = []
35
45
self ._players = players
0 commit comments