Discover the answers you need at Westonci.ca, where experts provide clear and concise information on various topics. Discover solutions to your questions from experienced professionals across multiple fields on our comprehensive Q&A platform. Connect with a community of professionals ready to help you find accurate solutions to your questions quickly and efficiently.
Sagot :
Answer:
Explanation:
The following code is written in Python and creates a class called customer which holds the customers name, purchase history amount, and current total. It also has 3 functions, a constructor that takes the customer name as a parameter. The add_to_cart function which increases the amount of the current total. And finally the checkout function which applies the available coupon and resets the variables if needed, as well as prints the info the to screen.
class Customer():
customer = ""
purchased_history = 0
current_total = 0
def __init__(self, name):
self.customer = name
def add_to_cart(self, amount):
self.current_total += amount
def checkout(self):
if self.purchased_history >= 100:
self.current_total *= 0.90
self.purchased_history = 0
else:
self.purchased_history += self.current_total
print(self.customer + " current total is: $" + str(self.current_total))
self.current_total = 0
We hope you found this helpful. Feel free to come back anytime for more accurate answers and updated information. Thanks for using our platform. We aim to provide accurate and up-to-date answers to all your queries. Come back soon. We're glad you chose Westonci.ca. Revisit us for updated answers from our knowledgeable team.