Skip to content

Commit

Permalink
1_failed
Browse files Browse the repository at this point in the history
  • Loading branch information
Yehorchyk committed Dec 21, 2024
1 parent 16d8349 commit d8a3082
Showing 1 changed file with 42 additions and 5 deletions.
47 changes: 42 additions & 5 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,45 @@
class Car:
# write your code here
pass
def __init__(self, comfort_class: int, clean_mark: int, brand: str):
self.comfort_class = comfort_class
self.clean_mark = clean_mark
self.brand = brand
class CarWashStation:
def __init__(self,
distance_from_city_center: float,
clean_power: float,
average_rating: float,
count_of_ratings: int
):
self.distance_from_city_center = distance_from_city_center
self.clean_power = clean_power
self.average_rating = average_rating
self.count_of_ratings = count_of_ratings

def serve_cars(self, cars: list):
income = 0
for car in cars:
if car.clean_mark < self.clean_power:
income += (car.comfort_class *
(self.clean_power - car.clean_mark) *
(self.average_rating/self.distance_from_city_center))
car.clean_mark = self.clean_power
return round(income, 1)

class CarWashStation:
# write your code here
pass
def calculate_washing_price(self, car: str):
self.car = car
wash_cost = (car.comfort_class *
(self.clean_power - car.clean_mark) *
(self.average_rating / self.distance_from_city_center))
return wash_cost

def wash_single_car(self, car: str):
if car.clean_mark < self.clean_power:
car.clean_mark = self.clean_power
return car.clean_mark

def rate_service(self, rate: int):
self.rate = rate
self.count_of_ratings += 1
self.average_rating = round((((self.average_rating * (self.count_of_ratings - 1))
+ rate)/self.count_of_ratings), 1)
return self.average_rating

0 comments on commit d8a3082

Please sign in to comment.