Skip to content

Commit 4160f0e

Browse files
committed
feat: add module 4 project
1 parent 39ff2a8 commit 4160f0e

12 files changed

+543
-2
lines changed

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
![Python badge](https://img.shields.io/badge/Python-FFD43B?style=for-the-badge&logo=python&logoColor=blue)
88
![Jupyter badge](https://img.shields.io/badge/Jupyter-F37626.svg?&style=for-the-badge&logo=Jupyter&logoColor=white)
99

10-
### [Applying object-oriented programming in Python. 🗺️Animal>🐍🦆🦢](https://colab.research.google.com/github/armincano/fullstack-python-web-dev/blob/main/m4-python-oop/oop-in-python.ipynb)
10+
### Module Project: [A control system to create instances and save them in a 'csv' file 🚙🏍️🚛](./m4-python-oop/car_toll_control_system/)
11+
12+
### [Applying object-oriented programming in Python 🦆🦢🐓](https://colab.research.google.com/github/armincano/fullstack-python-web-dev/blob/main/m4-python-oop/oop-in-python.ipynb)
1113

1214
### [@property decorator, the Python way for Getters and Setters 🔐](https://colab.research.google.com/github/armincano/fullstack-python-web-dev/blob/main/m4-python-oop/property_decorator.ipynb)
1315

@@ -34,7 +36,7 @@
3436
![JavaScrip badge](https://img.shields.io/badge/JavaScript-323330?style=for-the-badge&logo=javascript&logoColor=F7DF1E)
3537
![jQuery badge](https://img.shields.io/badge/jQuery-0769AD?style=for-the-badge&logo=jquery&logoColor=white)
3638

37-
### Final project: 🐍🤓 [Portfolio of a Python Webdev Student](./m2-front-end-101/project-portfolio/index.html)
39+
### Module project: 🐍🤓 [Portfolio of a Python Webdev Student](./m2-front-end-101/project-portfolio/index.html)
3840

3941
### HTML
4042

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<class 'electric_car.PersonalCar'>,"{'_Vehicle__brand': 'Tesla', '_Vehicle__model': 'Model S Plaid', '_Vehicle__wheels_number': 4, '_ElectricCar__speed': 250, '_ElectricCar__motor_power': 750, '_ElectricCar__range': 637, '_ElectricCar__battery_capacity': 100, '_PersonalCar__seats': 5}"
2+
<class 'electric_car.PersonalCar'>,"{'_Vehicle__brand': 'BYD', '_Vehicle__model': 'Han', '_Vehicle__wheels_number': 4, '_ElectricCar__speed': 180, '_ElectricCar__motor_power': 363, '_ElectricCar__range': 605, '_ElectricCar__battery_capacity': 85.4, '_PersonalCar__seats': 5}"
3+
<class 'electric_car.CargoCar'>,"{'_Vehicle__brand': 'Tesla', '_Vehicle__model': 'Cybertruck', '_Vehicle__wheels_number': 6, '_ElectricCar__speed': 200, '_ElectricCar__motor_power': 800, '_ElectricCar__range': 800, '_ElectricCar__battery_capacity': 200, '_CargoCar__load_weight': 1500}"
4+
<class 'bicycle.Bicycle'>,"{'_Vehicle__brand': 'Shimano', '_Vehicle__model': 'MT Ranger', '_Vehicle__wheels_number': 2, '_Bicycle__type': 'Racing'}"
5+
<class 'bicycle.Motorcycle'>,"{'_Vehicle__brand': 'Yamaha', '_Vehicle__model': 'MT-07', '_Vehicle__wheels_number': 2, '_Bicycle__type': 'Racing', '_Motorcycle__spokes_number': 36, '_Motorcycle__frame': 'Aluminum', '_Motorcycle__engine': '689cc inline twin'}"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
from vehicle import Vehicle
2+
3+
4+
class Bicycle(Vehicle):
5+
def __init__(self, brand: str, model: str, wheels_number: int, type: str):
6+
super().__init__(brand, model, wheels_number)
7+
self.__type = type
8+
9+
def __str__(self):
10+
return f"{super().__str__()}, Type: {self.__type}"
11+
12+
@property
13+
def type(self):
14+
return self.__type
15+
@type.setter
16+
def type(self, type):
17+
self.__type = type
18+
19+
@classmethod
20+
def shimano_mt_ranger(cls):
21+
return cls(brand="Shimano", model="MT Ranger", wheels_number=2, type="Racing")
22+
23+
24+
class Motorcycle(Bicycle):
25+
def __init__(
26+
self,
27+
brand: str,
28+
model: str,
29+
wheels_number: int,
30+
type: str,
31+
spokes_number: int,
32+
frame: str,
33+
engine: str,
34+
):
35+
super().__init__(brand, model, wheels_number, type)
36+
self.__spokes_number = spokes_number
37+
self.__frame = frame
38+
self.__engine = engine
39+
40+
def __str__(self):
41+
return f"{super().__str__()}, Spokes: {self.__spokes_number}, Frame: {self.__frame}, Engine: {self.__engine}"
42+
43+
@property
44+
def spokes_number(self):
45+
return self.__spokes_number
46+
@spokes_number.setter
47+
def spokes_number(self, spokes_number):
48+
self.__spokes_number = spokes_number
49+
50+
@property
51+
def frame(self):
52+
return self.__frame
53+
@frame.setter
54+
def frame(self, frame):
55+
self.__frame = frame
56+
57+
@property
58+
def engine(self):
59+
return self.__engine
60+
@engine.setter
61+
def engine(self, engine):
62+
self.__engine = engine
63+
64+
@classmethod
65+
def yamaha_mt07(cls):
66+
return cls(
67+
brand="Yamaha",
68+
model="MT-07",
69+
wheels_number=2,
70+
type="Racing",
71+
spokes_number=36,
72+
frame="Aluminum",
73+
engine="689cc inline twin",
74+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
<mxfile host="65bd71144e">
2+
<diagram id="gFjgcAYB47oY0xg-IKkI" name="Page-1">
3+
<mxGraphModel dx="410" dy="243" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
4+
<root>
5+
<mxCell id="0"/>
6+
<mxCell id="1" parent="0"/>
7+
<mxCell id="2" value="Vehicle" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;rounded=1;fillColor=#f0a30a;fontColor=#000000;strokeColor=#BD7000;gradientColor=none;swimlaneFillColor=none;" vertex="1" parent="1">
8+
<mxGeometry x="345" y="40" width="160" height="114" as="geometry"/>
9+
</mxCell>
10+
<mxCell id="3" value="- brand: str&#10;- model: str&#10;- wheels_number: int" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rounded=1;swimlaneFillColor=none;" vertex="1" parent="2">
11+
<mxGeometry y="26" width="160" height="54" as="geometry"/>
12+
</mxCell>
13+
<mxCell id="4" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;rounded=1;swimlaneFillColor=none;" vertex="1" parent="2">
14+
<mxGeometry y="80" width="160" height="8" as="geometry"/>
15+
</mxCell>
16+
<mxCell id="5" value="+ __str__(self): str" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rounded=1;swimlaneFillColor=none;" vertex="1" parent="2">
17+
<mxGeometry y="88" width="160" height="26" as="geometry"/>
18+
</mxCell>
19+
<mxCell id="6" value="ElectricCar" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;rounded=1;fillColor=#f0a30a;fontColor=#000000;strokeColor=#BD7000;gradientColor=none;swimlaneFillColor=none;" vertex="1" parent="1">
20+
<mxGeometry x="120" y="240" width="200" height="160" as="geometry"/>
21+
</mxCell>
22+
<mxCell id="7" value="- speed: int&#10;- motor_power: int&#10;- range: int&#10;- battery_capacity: float" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rounded=1;swimlaneFillColor=none;" vertex="1" parent="6">
23+
<mxGeometry y="26" width="200" height="64" as="geometry"/>
24+
</mxCell>
25+
<mxCell id="8" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;rounded=1;swimlaneFillColor=none;" vertex="1" parent="6">
26+
<mxGeometry y="90" width="200" height="8" as="geometry"/>
27+
</mxCell>
28+
<mxCell id="9" value="+ __str__(self): str" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rounded=1;swimlaneFillColor=none;" vertex="1" parent="6">
29+
<mxGeometry y="98" width="200" height="62" as="geometry"/>
30+
</mxCell>
31+
<mxCell id="11" value="Extends" style="endArrow=block;endSize=16;endFill=0;html=1;rounded=1;entryX=0.319;entryY=1.022;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" edge="1" parent="1" source="6" target="5">
32+
<mxGeometry width="160" relative="1" as="geometry">
33+
<mxPoint x="280" y="330" as="sourcePoint"/>
34+
<mxPoint x="440" y="330" as="targetPoint"/>
35+
</mxGeometry>
36+
</mxCell>
37+
<mxCell id="15" value="CargoCar" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;rounded=1;fillColor=#f0a30a;fontColor=#000000;strokeColor=#BD7000;gradientColor=none;swimlaneFillColor=none;" vertex="1" parent="1">
38+
<mxGeometry x="40" y="480" width="170" height="160" as="geometry"/>
39+
</mxCell>
40+
<mxCell id="16" value="- load_weight: float" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rounded=1;swimlaneFillColor=none;" vertex="1" parent="15">
41+
<mxGeometry y="26" width="170" height="64" as="geometry"/>
42+
</mxCell>
43+
<mxCell id="17" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;rounded=1;swimlaneFillColor=none;" vertex="1" parent="15">
44+
<mxGeometry y="90" width="170" height="8" as="geometry"/>
45+
</mxCell>
46+
<mxCell id="18" value="+ __str__(self): str&#10;+ tesla_cybertruck(cls): cls()" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rounded=1;swimlaneFillColor=none;" vertex="1" parent="15">
47+
<mxGeometry y="98" width="170" height="62" as="geometry"/>
48+
</mxCell>
49+
<mxCell id="19" value="PersonalCar" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;rounded=1;fillColor=#f0a30a;fontColor=#000000;strokeColor=#BD7000;gradientColor=none;swimlaneFillColor=none;" vertex="1" parent="1">
50+
<mxGeometry x="240" y="480" width="170" height="160" as="geometry"/>
51+
</mxCell>
52+
<mxCell id="20" value="- seats_number: int" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rounded=1;swimlaneFillColor=none;" vertex="1" parent="19">
53+
<mxGeometry y="26" width="170" height="64" as="geometry"/>
54+
</mxCell>
55+
<mxCell id="21" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;rounded=1;swimlaneFillColor=none;" vertex="1" parent="19">
56+
<mxGeometry y="90" width="170" height="8" as="geometry"/>
57+
</mxCell>
58+
<mxCell id="22" value="+ __str__(self): str&#10;+ tesla_model_s_plaid(cls): cls()&#10;+ byd_han(cls): cls()" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rounded=1;swimlaneFillColor=none;" vertex="1" parent="19">
59+
<mxGeometry y="98" width="170" height="62" as="geometry"/>
60+
</mxCell>
61+
<mxCell id="23" value="Extends" style="endArrow=block;endSize=16;endFill=0;html=1;rounded=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.375;entryY=1.032;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="15" target="9">
62+
<mxGeometry width="160" relative="1" as="geometry">
63+
<mxPoint x="150" y="480" as="sourcePoint"/>
64+
<mxPoint x="310" y="480" as="targetPoint"/>
65+
</mxGeometry>
66+
</mxCell>
67+
<mxCell id="24" value="Extends" style="endArrow=block;endSize=16;endFill=0;html=1;rounded=1;entryX=0.69;entryY=1.048;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" edge="1" parent="1" source="19" target="9">
68+
<mxGeometry width="160" relative="1" as="geometry">
69+
<mxPoint x="150" y="480" as="sourcePoint"/>
70+
<mxPoint x="310" y="480" as="targetPoint"/>
71+
</mxGeometry>
72+
</mxCell>
73+
<mxCell id="25" value="Bicycle" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;rounded=1;fillColor=#f0a30a;fontColor=#000000;strokeColor=#BD7000;gradientColor=none;swimlaneFillColor=none;" vertex="1" parent="1">
74+
<mxGeometry x="530" y="240" width="200" height="160" as="geometry"/>
75+
</mxCell>
76+
<mxCell id="26" value="- type: str" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rounded=1;swimlaneFillColor=none;" vertex="1" parent="25">
77+
<mxGeometry y="26" width="200" height="64" as="geometry"/>
78+
</mxCell>
79+
<mxCell id="27" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;rounded=1;swimlaneFillColor=none;" vertex="1" parent="25">
80+
<mxGeometry y="90" width="200" height="8" as="geometry"/>
81+
</mxCell>
82+
<mxCell id="28" value="+ __str__(self): str&#10;+ shimano_mt_ranger(cls): cls()" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rounded=1;swimlaneFillColor=none;" vertex="1" parent="25">
83+
<mxGeometry y="98" width="200" height="62" as="geometry"/>
84+
</mxCell>
85+
<mxCell id="29" value="Extends" style="endArrow=block;endSize=16;endFill=0;html=1;rounded=1;entryX=0.578;entryY=1.187;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" edge="1" parent="1" source="25" target="5">
86+
<mxGeometry width="160" relative="1" as="geometry">
87+
<mxPoint x="370" y="410" as="sourcePoint"/>
88+
<mxPoint x="530" y="410" as="targetPoint"/>
89+
</mxGeometry>
90+
</mxCell>
91+
<mxCell id="30" value="Motorcycle" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;rounded=1;fillColor=#f0a30a;fontColor=#000000;strokeColor=#BD7000;gradientColor=none;swimlaneFillColor=none;" vertex="1" parent="1">
92+
<mxGeometry x="545" y="480" width="170" height="160" as="geometry"/>
93+
</mxCell>
94+
<mxCell id="31" value="- number of spokes: int&#10;- frame: str&#10;- engine: str" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rounded=1;swimlaneFillColor=none;" vertex="1" parent="30">
95+
<mxGeometry y="26" width="170" height="64" as="geometry"/>
96+
</mxCell>
97+
<mxCell id="32" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;rounded=1;swimlaneFillColor=none;" vertex="1" parent="30">
98+
<mxGeometry y="90" width="170" height="8" as="geometry"/>
99+
</mxCell>
100+
<mxCell id="33" value="+ __str__(self): str&#10;+ yamaha_mt07(cls):cls()" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rounded=1;swimlaneFillColor=none;" vertex="1" parent="30">
101+
<mxGeometry y="98" width="170" height="62" as="geometry"/>
102+
</mxCell>
103+
<mxCell id="34" value="Extends" style="endArrow=block;endSize=16;endFill=0;html=1;rounded=1;entryX=0.499;entryY=1.043;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" edge="1" parent="1" source="30" target="28">
104+
<mxGeometry width="160" relative="1" as="geometry">
105+
<mxPoint x="560" y="430" as="sourcePoint"/>
106+
<mxPoint x="720" y="430" as="targetPoint"/>
107+
</mxGeometry>
108+
</mxCell>
109+
</root>
110+
</mxGraphModel>
111+
</diagram>
112+
</mxfile>

0 commit comments

Comments
 (0)