Advertisement
Guest User

Untitled

a guest
Aug 31st, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. ### assign3prep.py
  2. ### by Rob Marchiselli, Student ID# 2273872, COP1000
  3. # Pseudocode
  4. # Request number of pounds desired from user
  5. # Calculate per_pound rate based on pounds desired
  6. # Calculate subtotal before tax and shipping
  7. # Calculate shipping rate based on subtotal (if over $150 it's free)
  8. # Calculate taxes, order total
  9. # Print order summary
  10. def main():
  11. # Request pounds desired from user
  12. pounds = float(input('How many pounds are you ordering? '))
  13. # Determine cost per pound
  14. if pounds >= 40:
  15. per_pound = 7.50
  16. elif pounds >= 20:
  17. per_pound = 8.75
  18. elif pounds >= 10:
  19. per_pound = 10.00
  20. elif pounds < 10:
  21. per_pound = 12.00
  22. # Calculate subtotal before tax and shipping
  23. subtotal = float(pounds * per_pound)
  24. # Calculate shipping rate based on order subtotal
  25. if subtotal > 150:
  26. shipping = 0
  27. else:
  28. ship_rate = 1
  29. shipping = ship_rate * per_pound
  30. # Calculate taxes
  31. tax_rate = float(.07)
  32. taxes = subtotal * tax_rate
  33. # Calculate order total
  34. order_total = subtotal + taxes + shipping
  35. # Print order summary
  36. print('How many pounds are you ordering? ',format(pounds,'.0f'),sep='')
  37. print('Cost of coffee: $',format(subtotal,'.2f'),sep='')
  38. print('Sales tax (7%): $',format(taxes,'.2f'),sep='')
  39. print('Shipping fee: $',format(shipping,'.2f'),sep='')
  40. print('Total payable: $',format(order_total,'.2f'),sep='')
  41. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement