forked from vagabond-systems/forage-lyft-starter-repo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcar.py
28 lines (24 loc) · 930 Bytes
/
car.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
"""Defines the Car class."""
from serviceable import Serviceable
from engine.base_engine import Engine
from battery.base_battery import Battery
from tire.base_tire import Tire
class Car(Serviceable):
"""Creates a Car object.
The Car object is composed of an Engine, Battery and Tire.
Usage:
engine = Engine_type(......)
battery = Battery_type(......)
tire = Tire_type(......)
car_instance = Car(engine, battery, tire, ...)
"""
def __init__(self, engine: Engine, battery: Battery, tire: Tire = None):
self.engine = engine
self.battery = battery
self.tire = tire
def needs_service(self) -> bool:
"""Check if Car needs to be serviced
The fucntion checks the service status of each of
the components to determine if the car needs service
"""
return self.engine.needs_service() or self.battery.needs_service()