diff --git a/8/8.10 LAB/main.py b/8/8.10 LAB/main.py new file mode 100644 index 0000000..d32f987 --- /dev/null +++ b/8/8.10 LAB/main.py @@ -0,0 +1,27 @@ +class Team: + def __init__(self): + self.team_name = 'none' + self.team_wins = 0 + self.team_losses = 0 + self.win_percentage = 0 + + def get_win_percentage(self): + return self.team_wins / (self.team_wins + self.team_losses) + + +if __name__ == "__main__": + + team = Team() + + team_name = input() + team_wins = int(input()) + team_losses = int(input()) + + team.team_name = team_name + team.team_wins = team_wins + team.team_losses = team_losses + + if team.get_win_percentage() >= 0.5: + print('Congratulations, Team', team.team_name,'has a winning average!') + else: + print('Team', team.team_name, 'has a losing average.') diff --git a/8/8.6/8.6.1/main.py b/8/8.6/8.6.1/main.py new file mode 100644 index 0000000..7699107 --- /dev/null +++ b/8/8.6/8.6.1/main.py @@ -0,0 +1,24 @@ +class PhonePlan: + # FIXME add constructor + + def __init__(self, _num_mins=0, _num_messages=0): + self.num_mins = _num_mins + self.num_messages = _num_messages + + def print_plan(self): + print('Mins:', self.num_mins, end=' ') + print('Messages:', self.num_messages) + + +my_plan = PhonePlan(int(input()), int(input())) +dads_plan = PhonePlan() +moms_plan = PhonePlan(int(input())) + +print('My plan...', end=' ') +my_plan.print_plan() + +print('Dad\'s plan...', end=' ') +dads_plan.print_plan() + +print('Mom\'s plan...', end= ' ') +moms_plan.print_plan() diff --git a/8/8.8/8.8.1/main.py b/8/8.8/8.8.1/main.py new file mode 100644 index 0000000..6760e74 --- /dev/null +++ b/8/8.8/8.8.1/main.py @@ -0,0 +1,15 @@ +class CarRecord: + def __init__(self): + self.year_made = 0 + self.car_vin = '' + + # FIXME add __str__() + + def __str__(self): + return'Year: {0}, VIN: {1}'.format(self.year_made, self.car_vin) + +my_car = CarRecord() +my_car.year_made = int(input()) +my_car.car_vin = input() + +print(my_car) diff --git a/8/8.9 LAB/main.py b/8/8.9 LAB/main.py new file mode 100644 index 0000000..8aa4a43 --- /dev/null +++ b/8/8.9 LAB/main.py @@ -0,0 +1,28 @@ +class Car: + def __init__(self): + self.model_year = 0 + self.purchase_price = 0 + self.current_value = 0 + + def calc_current_value(self, current_year): + depreciation_rate = 0.15 + # Car depreciation formula + car_age = current_year - self.model_year + self.current_value = round(self.purchase_price * (1 - depreciation_rate) ** car_age) + + def print_info(self): + return """Car's information: + Model year: {0} + Purchase price: {1} + Current value: {2}""".format(self.model_year, self.purchase_price, self.current_value) + +if __name__ == "__main__": + year = int(input()) + price = int(input()) + current_year = int(input()) + + my_car = Car() + my_car.model_year = year + my_car.purchase_price = price + my_car.calc_current_value(current_year) + print(my_car.print_info())