class Discount:
def __init__(self, price, quantity, discount):
self.price = price
self.quantity = quantity
self.discount = discount
def get_discount(self):
return self.price * self.quantity * self.discount / 100
def get_total(self):
return self.price * self.quantity - self.get_discount()
price = float(input("Введите цену: "))
quantity = int(input("Введите количество: "))
discount = int(input("Введите процент скидки: "))
discount_obj = Discount(price, quantity, discount)
print(discount_obj.get_total())
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Verified answer
class Discount:
def __init__(self, price, quantity, discount):
self.price = price
self.quantity = quantity
self.discount = discount
def get_discount(self):
return self.price * self.quantity * self.discount / 100
def get_total(self):
return self.price * self.quantity - self.get_discount()
price = float(input("Введите цену: "))
quantity = int(input("Введите количество: "))
discount = int(input("Введите процент скидки: "))
discount_obj = Discount(price, quantity, discount)
print(discount_obj.get_total())