Skip to content

Commit

Permalink
wash car implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
Beliar24 committed Nov 3, 2024
1 parent 65fd014 commit e57f5da
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
class Car:
def __init__(self, comfort_class: int, clean_mark: int, brand: str) -> None:
def __init__(self,
comfort_class: int,
clean_mark: int,
brand: str) -> None:
self.comfort_class = comfort_class
self.clean_mark = clean_mark
self.brand = brand
Expand All @@ -26,9 +29,8 @@ def serve_cars(self, cars: list) -> float:
return round(total_income, 1)

def calculate_washing_price(self, car: Car) -> float:
return (car.comfort_class * (self.clean_power - car.clean_mark) *
self.average_rating /
self.distance_from_city_center)
return (car.comfort_class * (self.clean_power - car.clean_mark)
* self.average_rating / self.distance_from_city_center)

def wash_single_car(self, car: Car) -> None:
if self.clean_power > car.clean_mark:
Expand All @@ -37,6 +39,6 @@ def wash_single_car(self, car: Car) -> None:
def rate_service(self, new_rating: int) -> None:
total_ratings = self.count_of_ratings + 1
self.average_rating = round(
((self.average_rating * self.count_of_ratings) + new_rating) /
total_ratings, 1)
((self.average_rating * self.count_of_ratings) + new_rating)
/ total_ratings, 1)
self.count_of_ratings = total_ratings

0 comments on commit e57f5da

Please sign in to comment.