Skip to content

Commit 13d6dd2

Browse files
committed
Initial commit
1 parent d799ccd commit 13d6dd2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

boot-camp-18-day-2/oop_concepts/sports_man.py

+10
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,43 @@ class SportsMan(object):
33
pay_raise_index = 1.5
44

55
def __init__(self, fname, lname, salary):
6+
"""Initializes the parent class, SportsMan"""
67
self._fname = fname
78
self._lname = lname
89
self._salary = salary
910

1011
def fullname(self):
12+
"""Returns a sports man's full name"""
1113
return self._fname + ' ' + self._lname
1214

1315
def pay_raise(self):
16+
"""Calculates a sports man's salary"""
1417
self._salary *= self.pay_raise_index
1518
return self._salary
1619

1720

1821
class Player(SportsMan):
1922
"""This is a child class which inherits from SportsMan"""
23+
# A specific pay_rise_index for class player
2024
pay_raise_index = 2.0
2125

2226
def __init__(self, fname, lname, salary, skillset=None):
27+
"""Initializes class Player"""
28+
# attributes fname, lname, salary are superclass attributes
2329
super(Player, self).__init__(fname, lname, salary)
2430
self._skillset = skillset
2531

2632

2733
class Coach(SportsMan):
2834
"""A second class inheriting from SportsMan"""
35+
# a specific pay_rise_index for class coach
2936
pay_raise_index = 2.4
3037

3138
def __init__(self, fname, lname, salary, players=None):
39+
"""Initializes the class Coach"""
40+
# attributes fname, lname, salary superclass attributes
3241
super(Coach, self).__init__(fname, lname, salary)
3342
if players is None:
43+
# return an empty list if coach has no players
3444
self._players = []
3545
self._players = players

0 commit comments

Comments
 (0)