-
Notifications
You must be signed in to change notification settings - Fork 0
/
classes.py
179 lines (125 loc) · 3.08 KB
/
classes.py
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
class Animal():
minweight = 1
maxweight = 600
food = 2
product = []
def __init__(self):
self.minweight=minweight
self.maxweight=maxweight
self.food=food
self.product=product
def eat(self):
return self.food
def get_product(self):
return self.product
def get_name(self):
pass
def say(self):
pass
class Mammal(Animal):
legs = 4
def get_name(self):
pass
def say(self):
pass
class Bird(Animal):
legs = 2
wings = 2
def get_name(self):
pass
def say(self):
pass
class Cow(Mammal):
def __init__(self, name):
self.name = name
self.minweight=50
self.maxweight=600
self.product=['milk', 'meat']
self.scream='Mooo'
def eat(self):
return food*20
def say(self):
return scream*3
Cow_1 = Cow('Vera')
Cow_2 = Cow('Lena')
Cow_3 = Cow('Vova')
class Goat(Mammal):
def __init__(self, name):
self.name = name
self.minweight=10
self.maxweight=50
self.product=['milk', 'meat', 'leather']
self.scream='Beeeee'
def eat(self):
return food*2
def say(self):
return scream
def leather_count(self):
return (maxweigth-minweight)/4
Goat_1 = Goat('Vasya')
Goat_2 = Goat('Zorya')
Goat_3 = Goat('Mila')
class Sheep(Mammal):
def __init__(self, name):
self.name = name
self.minweight=10
self.maxweight=50
self.product=['meat', 'leather', 'wool']
self.scream='Meeeee'
def eat(self):
return food * 2
def say(self):
return scream
Sheep_1 = Sheep('Fedya')
class Pig(Mammal):
def __init__(self, name):
self.name = name
self.minweight=30
self.maxweight=150
self.product=['meat', 'leather']
self.scream='Hryu'
def eat(self):
return food * 10
def say(self):
return scream
def leather_count(self):
return (maxweigth - minweight) / 4
Pig_1 = Pig('Hryak')
class Chiken(Bird):
def __init__(self):
self.minweight=1
self.maxweight=5
self.product=['meat', 'eggs']
self.scream='ko'
def eat(self):
return food/8
def get_eggs(self):
return 1
def say(self):
return scream*3
Chiken_1 = Chiken()
class Goose(Bird):
def __init__(self):
self.minweight=50
self.maxweight=600
self.product=['meat', 'eggs']
self.scream='ga'
def eat(self):
return food / 5
def get_eggs(self):
return 1
def say(self):
return scream * 3
Goose_1 = Goose()
class Duck(Bird):
minweight = 1
maxweight = 10
product = ['meat', 'eggs']
scream = 'ga'
def eat(self):
return food / 5
def get_eggs(self):
return 1
def say(self):
return scream * 3
Duck_1 = Duck()