Get reliable answers to your questions at Westonci.ca, where our knowledgeable community is always ready to help. Discover a wealth of knowledge from experts across different disciplines on our comprehensive Q&A platform. Connect with a community of professionals ready to provide precise solutions to your questions quickly and accurately.
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
Thanks for stopping by. We strive to provide the best answers for all your questions. See you again soon. We appreciate your time. Please come back anytime for the latest information and answers to your questions. We're here to help at Westonci.ca. Keep visiting for the best answers to your questions.