- Read the guideline before start
You own a car washing station. Washing cost calculation takes a lot of time, and you decide to automate this calculation. The washing cost will depend on car comfort class, car cleanness degree, wash station average rating and wash station distance from the center of the city.
Create class Car
, its constructor takes and stores
3 arguments:
comfort_class
- comfort class of a car, from 1 to 7clean_mark
- car cleanness mark, from very dirty - 1 to absolutely clean - 10brand
- brand of the car
Create class CarWashStation
, its constructor takes and
stores 4 arguments:
distance_from_city_center
- how far station from the city center, from 1.0 to 10.0clean_power
-clean_mark
to which this car wash station washes (yes, not all stations can clean your car completely)average_rating
- average rating of the station, from 1.0 to 5.0, rounded to 1 decimalcount_of_ratings
- number of people who rated
CarWashStation
should have such methods:
serve_cars
- method, that takes a list ofCar
's, washes only cars withclean_mark
<clean_power
of wash station and returns income of CarWashStation for serving this list of Car's, rounded to 1 decimalcalculate_washing_price
- method, that calculates cost for a single car wash, cost is calculated as: car's comfort class * difference between wash station's clean power and car's clean mark * car wash station rating / car wash station distance to the center of the city, returns number rounded to 1 decimalwash_single_car
- method, that washes a single car, so it should haveclean_mark
equals wash station'sclean_power
, ifwash_station.clean_power
is greater thancar.clean_mark
rate_service
- method to add a single rate.
You can add own methods if you need.
Example:
bmw = Car(3, 3, 'BMW')
audi = Car(4, 9, 'Audi')
mercedes = Car(7, 1, 'Mercedes')
ws = CarWashStation(6, 8, 3.9, 11)
income = ws.serve_cars([
bmw,
audi,
mercedes
])
income == 41.7
bmw.clean_mark == 8
audi.clean_mark == 9
mercedes.clean_mark == 8
# audi wasn't washed
# all other cars are washed to '8'
ford = Car(2, 1, 'Ford')
wash_cost = ws.calculate_washing_price(ford)
# only calculating cost, not washing
wash_cost == 9.1
ford.clean_mark == 1
ws.rate_service(5)
ws.count_of_ratings == 12
ws.average_rating == 4.0