-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinherit_1.py
More file actions
65 lines (53 loc) · 1.54 KB
/
inherit_1.py
File metadata and controls
65 lines (53 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
class Table:
def __init__(self, l, w, h):
self.long = l
self.width = w
self.height = h
def outing(self):
print(self.long, self.width, self.height)
def howplaces(self, s):
pass
class Kitchen(Table):
def howplaces(self, n):
if n < 2:
print("It is not kitchen table")
else:
self.places = n
def outplases(self):
print(self.places)
class Worker(Table):
def work(self, hours):
money = hours * 25
if hours >= 4:
print("You earned", money, "$")
else:
print("Don't get up of the table! You are not done yet")
self.trash_check(hours)
return money
def trash_check(self, hours):
surface = hours * 1.5
if self.width * self.long >= surface > (self.width * self.long)/2:
print("Maybe you should clean your table up! Or you will get fired")
elif surface >= self.width * self.long:
print('you are a pig')
if input('Do you want to clean your table?') == 'yes':
surface = 0
print('You have cleaned your table! Get back to work!')
else:
print('you are fired!')
exit(5)
return surface
t_room1 = Kitchen(2, 1, 0.5)
t_room1.outing()
t_room1.howplaces(5)
t_room1.outplases()
t_2 = Table(1, 3, 0.7)
t_2.outing()
t_2.howplaces(8)
w_1 = Worker(2, 3, 6)
while True:
h = input('Input working hours: ')
if h == 'no':
exit()
else:
w_1.work(int(h))