-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdecomposicion.py
More file actions
57 lines (40 loc) · 1.5 KB
/
Copy pathdecomposicion.py
File metadata and controls
57 lines (40 loc) · 1.5 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
class Automovil:
def __init__(self, modelo, marca, color):
self.modelo = modelo
self.marca = marca
self.color = color
self._estado = 'en_reposo'
self._frenos = Frenos(calidad = 'buena')
self._motor = Motor(cilindros = 4)
def acelerar(self, tipo='despacio'):
if tipo == 'rapida':
self._motor.inyecta_gasolina(10)
else:
self._motor.inyecta_gasolina(3)
self._estado = 'en_movimiento'
def frenar(self, tipo='despacio'):
if tipo == 'rapida' and self._frenos.calidad == 'buena':
self._motor.inyecta_gasolina(0)
self._frenos.friccion(100)
self._estado = 'en_reposo'
elif tipo == 'rapida' and self._frenos.calidad == 'regular':
self.motor.inyecta_gasolina(0)
self._frenos.friccion(50)
elif tipo == 'despacio' and self._frenos.calidad == 'buena':
self.motor.inyecta_gasolina(5)
self._frenos.friccion(50)
elif tipo == 'despacio' and self._frenos.calidad == 'regular':
self.motor.inyecta_gasolina(5)
self._frenos.friccion(30)
class Motor:
def __init__(self, cilindros, tipo='gasolina'):
self.cilindros = cilindros
self.tipo = tipo
self._temperatura = 0
def inyecta_gasolina(self, cantidad):
pass
class Frenos:
def __init__(self, calidad='buena'):
self.calidad = calidad
def friccion(self, intensidad):
pass