-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbicycle.py
74 lines (62 loc) · 1.84 KB
/
bicycle.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
from vehicle import Vehicle
class Bicycle(Vehicle):
def __init__(self, brand: str, model: str, wheels_number: int, type: str):
super().__init__(brand, model, wheels_number)
self.__type = type
def __str__(self):
return f"{super().__str__()}, Type: {self.__type}"
@property
def type(self):
return self.__type
@type.setter
def type(self, type):
self.__type = type
@classmethod
def shimano_mt_ranger(cls):
return cls(brand="Shimano", model="MT Ranger", wheels_number=2, type="Racing")
class Motorcycle(Bicycle):
def __init__(
self,
brand: str,
model: str,
wheels_number: int,
type: str,
spokes_number: int,
frame: str,
engine: str,
):
super().__init__(brand, model, wheels_number, type)
self.__spokes_number = spokes_number
self.__frame = frame
self.__engine = engine
def __str__(self):
return f"{super().__str__()}, Spokes: {self.__spokes_number}, Frame: {self.__frame}, Engine: {self.__engine}"
@property
def spokes_number(self):
return self.__spokes_number
@spokes_number.setter
def spokes_number(self, spokes_number):
self.__spokes_number = spokes_number
@property
def frame(self):
return self.__frame
@frame.setter
def frame(self, frame):
self.__frame = frame
@property
def engine(self):
return self.__engine
@engine.setter
def engine(self, engine):
self.__engine = engine
@classmethod
def yamaha_mt07(cls):
return cls(
brand="Yamaha",
model="MT-07",
wheels_number=2,
type="Racing",
spokes_number=36,
frame="Aluminum",
engine="689cc inline twin",
)