Advertisement
biswasrohit20

sleep

Mar 14th, 2021
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.48 KB | None | 0 0
  1. print("Welcome!\n")
  2. while True:
  3. brand = int(input("Please select the mattress brand (1 - Sealy, 2 - Simmons): "))
  4. if brand == 1 or brand == 2:
  5. break
  6. print("Invalid brand name!")
  7.  
  8.  
  9. if brand == 1:
  10. while True:
  11. size = input("Please select the size (K - King, Q - Queen, T - Twin): ").upper()
  12. if size in ["K", "Q", "T"]:
  13. break
  14. print("Invalid size!")
  15.  
  16. while True:
  17. comfort = input("Please select the comfort level (M - Medium, F - Firm, E - Extra Firm): ").upper()
  18. if comfort in ["M", "F", "E"]:
  19. break
  20. print("Invalid comfort level!")
  21.  
  22. else:
  23. while True:
  24. size = input("Please select the size (K - King, Q - Queen, F - Full): ").upper()
  25. if size in ["K", "Q", "F"]:
  26. break
  27. print("Invalid size!")
  28.  
  29. while True:
  30. comfort = input("Please select the comfort level (C - Cushion Firm, F - Firm, E - Extra Firm): ").upper()
  31. if comfort in ["C", "F", "E"]:
  32. break
  33. print("Invalid comfort level!")
  34.  
  35.  
  36. while True:
  37. spring = input("Do you like to have box springs (Y - Yes, N - No)? ").upper()
  38. if spring in ["Y", "N"]:
  39. break
  40. print("Invalid input!")
  41.  
  42. while True:
  43. delivery = input("Which shipping mode do you like (S - Standard, N - Next Day)? ").upper()
  44. if delivery in ["S", "N"]:
  45. break
  46. print("Invalid input!")
  47.  
  48. code = input("Promotion code: ").upper()
  49.  
  50. if brand == 1:
  51. name = "Sealy, "
  52. if size == "K":
  53. name += "King Size, "
  54. box = 400
  55. if comfort == "M":
  56. cost = 1800
  57. elif comfort == "F":
  58. cost = 2200
  59. elif comfort == "E":
  60. cost = 2400
  61.  
  62. elif size == "Q":
  63. name += "Queen Size, "
  64. box = 300
  65. if comfort == "M":
  66. cost = 1400
  67.  
  68. elif comfort == "F":
  69. cost = 1800
  70.  
  71. elif comfort == "E":
  72. cost = 2000
  73.  
  74. elif size == "T":
  75. name += "Twin Size, "
  76. box = 100
  77. if comfort == "M":
  78. cost = 900
  79.  
  80. elif comfort == "F":
  81. cost = 1300
  82.  
  83. elif comfort == "E":
  84. cost = 1500
  85.  
  86.  
  87. elif brand == 2:
  88. name = "Sealy, "
  89. if size == "K":
  90. name += "King Size, "
  91. box = 400
  92. if comfort == "C":
  93. cost = 2000
  94.  
  95. elif comfort == "F":
  96. cost = 2500
  97.  
  98. elif comfort == "E":
  99. cost = 3000
  100.  
  101. elif size == "Q":
  102. name += "Queen Size, "
  103. box = 300
  104. if comfort == "C":
  105. cost = 1400
  106.  
  107. elif comfort == "F":
  108. cost = 1900
  109.  
  110. elif comfort == "E":
  111. cost = 2400
  112.  
  113. elif size == "F":
  114. name += "Full Size, "
  115. box = 200
  116. if comfort == "C":
  117. cost = 1000
  118.  
  119. elif comfort == "F":
  120. cost = 1500
  121.  
  122. elif comfort == "E":
  123. cost = 2000
  124.  
  125.  
  126. if comfort == "C":
  127. name += "Cushion Firm:"
  128. elif comfort == "F":
  129. name += "Firm:"
  130. elif comfort == "E":
  131. name += "Extra Firm:"
  132. elif comfort == "M":
  133. name += "Medium:"
  134.  
  135.  
  136.  
  137. print("===============Order Summary====================")
  138. print(name)
  139. if cost >= 1000:
  140. print(f'Mattress: ${"{:,.2f}".format(cost)}')
  141. else:
  142. print(f'Mattress: $ {"{:,.2f}".format(cost)}')
  143. if spring == "Y":
  144. print(f'Box springs: $ {"{:,.2f}".format(box)}')
  145. if code == "SLEEP":
  146. dis = (cost+box)/10
  147. sub = cost + box - ((cost+box)/10)
  148. else:
  149. sub = cost + box
  150. else:
  151. if code == "SLEEP":
  152. dis = cost/10
  153. sub = cost - ((cost) / 10)
  154. else:
  155. sub = cost
  156.  
  157. if dis<100:
  158. print(f'Discount: $ -{"{:,.2f}".format(dis)}')
  159. else:
  160. print(f'Discount: $ -{"{:,.2f}".format(dis)}')
  161. if sub >= 1000:
  162. print(f'Subtotal: ${"{:,.2f}".format(sub)}')
  163. else:
  164. print(f'Subtotal: $ {"{:,.2f}".format(sub)}')
  165.  
  166. if delivery == "S":
  167. deli = 100
  168. print("Standard shipping: $ 100.00")
  169. else:
  170. deli = 300
  171. print("Next-day shipping: $ 300.00")
  172.  
  173. tax = sub * 0.0625
  174. if tax <100:
  175. print(f'Tax: $ {"{:,.2f}".format(tax)}')
  176. else:
  177. print(f'Tax: $ {"{:,.2f}".format(tax)}')
  178.  
  179. print("------------------------------------------------")
  180. total = sub + deli + tax
  181.  
  182. if total >=1000:
  183. print(f'Total: ${"{:,.2f}".format(total)}')
  184. else:
  185. print(f'Total: $ {"{:,.2f}".format(total)}')
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement