Advertisement
biswasrohit20

mat

Mar 14th, 2021
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.69 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. if dis < 100:
  149. print(f'Discount: $ -{"{:,.2f}".format(dis)}')
  150. else:
  151. print(f'Discount: $ -{"{:,.2f}".format(dis)}')
  152. else:
  153. sub = cost + box
  154. else:
  155. if code == "SLEEP":
  156. dis = cost/10
  157. sub = cost - ((cost) / 10)
  158. if dis < 100:
  159. print(f'Discount: $ -{"{:,.2f}".format(dis)}')
  160. else:
  161. print(f'Discount: $ -{"{:,.2f}".format(dis)}')
  162. else:
  163. sub = cost
  164.  
  165.  
  166. if sub >= 1000:
  167. print(f'Subtotal: ${"{:,.2f}".format(sub)}')
  168. else:
  169. print(f'Subtotal: $ {"{:,.2f}".format(sub)}')
  170.  
  171. if delivery == "S":
  172. deli = 100
  173. print("Standard shipping: $ 100.00")
  174. else:
  175. deli = 300
  176. print("Next-day shipping: $ 300.00")
  177.  
  178. tax = sub * 0.0625
  179. if tax <100:
  180. print(f'Tax: $ {"{:,.2f}".format(tax)}')
  181. else:
  182. print(f'Tax: $ {"{:,.2f}".format(tax)}')
  183.  
  184. print("------------------------------------------------")
  185. total = sub + deli + tax
  186.  
  187. if total >=1000:
  188. print(f'Total: ${"{:,.2f}".format(total)}')
  189. else:
  190. print(f'Total: $ {"{:,.2f}".format(total)}')
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement