Advertisement
Guest User

Untitled

a guest
Jan 27th, 2020
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. # ___________________________________________ USER INPUT
  2. print("Welcome to our ridesharing app!")
  3.  
  4. class_sessions = int(input("How many days per week does your class at (Smith Hall) meet?"))
  5. weeks_left = int(input("How many weeks are left in the semester?"))
  6. gas_price = input("What is the current price of gas per gallon in US dollars?")
  7. mpg = input("What is the average mileage in miles per gallon for your car?")
  8. distance = input("What is the one-way distance from your home or dormitory to (Smith Hall) in miles?")
  9.  
  10. # ______________________________________ CONSTANT VALUES
  11. price_per_mile = 0.25
  12.  
  13. # _________________________________________ CALCULATIONS
  14.  
  15. #___________________ FYI RESULTS
  16.  
  17. round_trips = int(class_sessions) * int(weeks_left)
  18. miles_per_semester = float(distance) * float(round_trips) * 2
  19. gas_total = ((float(distance) / float(mpg)) * float(gas_price) * 2)
  20. roundtrip_total = (float(price_per_mile) * float(distance)) * 2 + float(gas_total)
  21.  
  22. # ________ COST FOR THE SEMESTER
  23.  
  24. one_person = float(roundtrip_total) * float(round_trips)
  25. two_people = float(one_person) / 2
  26. three_people = float(one_person / 3
  27.  
  28. # _____________________________________ DISPLAYED RESULT
  29.  
  30. print("******** RIDE SHARING APP **********")
  31. print()
  32. print("DATA YOU PROVIDED")
  33. print("Gas costs $", gas_price, " per gallon")
  34. print("Car averages ", mpg, " miles per gallon")
  35. print("Class meets ", class_sessions, " days/week, ", weeks_left, " weeks/semester")
  36. print("Distance to (Smith Hall): ", distance, " miles one-way")
  37. print()
  38. print("FIXED GENERIC COST")
  39. print("$0.25 per mile")
  40. print()
  41. print("FYI RESULTS")
  42. print(round_trips, " round trips/semester")
  43. print(miles_per_semester, " total miles/semester")
  44. print("$", roundtrip_total, " total for 1 round trip ($", gas_total, " for gas)")
  45. print()
  46. print("COST FOR THE SEMESTER")
  47. print("1 person alone: $", one_person)
  48. print("2 people sharing: $", two_people, " per person")
  49. print("3 people sharing: $", three_people, " per person")
  50. print("*************** THE END ***************")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement