class CashRegister:
'''
Cash register that records the total cost of items and adds tax.
'''
def __init__(self, rate):
self.balance = 0
self.tax_rate = rate
def add_item(self, cost):
'''
Adds an item with the given cost to this register's total.
'''
self.balance += cost
def get_total(self):
'''
Returns the total cost of all added items, plus 10% tax.
'''
tax = self.balance * self.tax_rate
return self.balance + tax
def clear(self):
'''
Clears the register to start adding new items.
'''
self.balance = 0