def test_calculate_tip(self): # arrange tipcalc = TipCalculator() tipcalc.set_bill_amount("10.10") tipcalc.set_tip_rate("20") # act tip_amount = tipcalc.calculate_tip() # assert self.assertEqual(tip_amount, 2.02)
def test_calculate_total(self): # arrange tipcalc = TipCalculator() tipcalc.set_bill_amount("10.10") tipcalc.set_tip_rate("20") tipcalc.calculate_tip() # act total = tipcalc.calculate_total() # assert self.assertEqual(total, 12.12)
from calculator.TipCalculator import TipCalculator __author__ = 'joseph swager' tipCalc = TipCalculator() tipCalc.set_bill_amount(input("What is the bill amount?")) tipCalc.set_tip_rate(input("What is the tip rate?")) tipCalc.calculate_tip() print("The tip is $", end="") print("{0:.2f}".format(tipCalc.tip.tipAmount)) tipCalc.calculate_total() print("The Total is $", end="") print("{0:.2f}".format(tipCalc.bill.total))