Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.03 KB | None | 0 0
  1. PRICE = 14.99
  2. SHIPPING_COST = 0.89
  3. ONLINE_CHARGE = 1.50
  4. TAX_RATE = 0.13
  5.  
  6. def get_number_of_pounds():
  7.     number_of_pounds = int(input("Enter pounds of coffee: \n"))
  8.     return number_of_pounds
  9.  
  10. def price_of_coffee():
  11.     return round(pounds * PRICE, 2)
  12.  
  13. def price_of_shipping():
  14.     shipping_charges = round((pounds * SHIPPING_COST) + ONLINE_CHARGE, 2)
  15.     return shipping_charges
  16.  
  17. def price_of_tax():
  18.     tax = round((subtotal + shipping) * TAX_RATE, 2)
  19.     return tax
  20.  
  21. def grand_total_price():
  22.     return round(subtotal + shipping + taxprice, 2)
  23.  
  24. def receipt_of_purchase():
  25.     print('-'*32)
  26.     print(pounds, 'lbs @', PRICE, '/ lb\t\t$', subtotal)
  27.     print('Shipping:\t\t\t\t$', shipping_charges)
  28.     print('Tax:\t\t\t\t\t$', taxprice)
  29.     print('-'*32)
  30.     print('Total:\t\t\t\t\t$', total)
  31.     print('-'*32)
  32.  
  33. if __name__ == "__main__":
  34.     pounds = get_number_of_pounds()
  35.     subtotal = price_of_coffee()
  36.     shipping = price_of_shipping()
  37.     taxprice = price_of_tax()
  38.     total = grand_total_price()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement