Lab 5: Taking a Vacation

Lab Description:

In this lab I had to calculate how much I would spend on a vacation.  I had to calculate the cost of the plane ticket, hotel cost, and car rental cost. With all these I had to also calculate how much my credit card bill would be with the interest and if i decided to pay only half of the bill.

Source code:

def hotel_cost(nights):
return nights * 140

bill = hotel_cost(5)

def add_monthly_interest(balance):
return balance * (1 + (0.15 / 12))

def make_payment(payment, balance):
print “You still owe: %s” %balance
bal = balance – payment

return add_monthly_interest(bal)

new_bill= make_payment(bill/2, bill)

final = make_payment(100, new_bill)
print final

Screenshots:

taking a vacationtaking a vacation result

Leave a Reply

Your email address will not be published. Required fields are marked *