Guest User

Untitled

a guest
Mar 19th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.61 KB | None | 0 0
  1. import time
  2. class Account:
  3. def __init__(self):
  4. self.style = {'1':"sporty", '2':"gimmick", '3':"casual", '4':"kpop", '5':"simple"}
  5. self.price = {'1':5, '2':10, '3':15, '4':20, '5':25}
  6.  
  7. def stock(self):
  8. stock = {'sporty':5,'gimmick':5,'casual':5,'kpop':5,'simple':5}
  9. for digit in enter_quantity:
  10. for styles in enter_item:
  11. a = self.style[styles]
  12. for a in stock:
  13. b = int(stock[a])
  14. if (b < digit):
  15. print ("{} can't provide that quantity".format(self.style[styles]))
  16. else:
  17. stock_left = b - digit
  18. # print (stock_left)
  19.  
  20. def getTotal(self,final_order):
  21. cont = "true"
  22. list_style = []
  23. while cont == "true":
  24. overAllTotal = 0
  25. # for num in entity:
  26. # list_style.append(self.style[num])
  27. # overAllTotal = 0
  28. # for digit in quantity:
  29. # cost = self.price[num] * digit
  30. # total = float(format(cost, '.2f'))
  31. # overAllTotal += total
  32. # cont = "true"
  33. for item,quantity in final_order.items():
  34. list_style.append(self.style[str(item)])
  35. overAllTotal += float(self.price[str(item)] * quantity)
  36. print ("Total Payment: "+str(overAllTotal)+" php")
  37. count1 = "true"
  38. while (count1 == "true"):
  39. Cash = int(input("AMOUNT: "))
  40. if (Cash >= overAllTotal):
  41. change = float(format(Cash - overAllTotal, '.2f'))
  42. print ("CHANGE: "+str(change)+"php")
  43. count1 = "false"
  44. elif (Cash < overAllTotal):
  45. print ("Your money is not enough!")
  46. count1 = "true"
  47. print ("\nCustomer's Receipt\nOutfit Style\t\t:\t"+str(list_style)+'\n'+"Quantity of Purchase\t: \t"+str(quantity)+" pieces"+"\nTotal\t\t\t: \t"+str(overAllTotal)+" php"+"\nAmount\t\t\t: \t"+str(Cash)+"php""\nChange\t\t\t: \t"+str(change)+"php")
  48. now = time.strftime("%c")
  49. print (now)
  50. print ("Thank you!\nCome again!")
  51. cont = "false"
  52.  
  53. print ("\t\t\tFASHION APPAREL\n\t\twhere you can fit your suit!\t\t\n")
  54. time.sleep(1)
  55. print ("The following are the outfit that is available in one set.\nChoose the appropriate number of style.)")
  56. print ("\tSTYLE\t\t\tPrice per Set\n"
  57. "\t(1)SPORTY\t\t5.00php\n"
  58. "\t(2)GIMMICK\t\t10.00php\n"
  59. "\t(3)CASUAL\t\t15.00php\n"
  60. "\t(4)KPOP\t\t\t20.00php\n"
  61. "\t(5)SIMPLE\t\t25.0php")
  62.  
  63. count1 = "true"
  64. enter_item = []
  65. enter_quantity = []
  66. while (count1 == "true"):
  67. counter = "true"
  68. while (counter == "true"):
  69. try:
  70. item = input("\nItem to purchase: ")
  71. if (item == '1' or item == '2' or item == '3' or item == '4' or item == '5'):
  72. are_sure = input("are you sure?(y/n): ")
  73. if (are_sure.lower() == "y" or are_sure.lower() == "yes"):
  74. enter_item.append(item)
  75. print(enter_item)
  76. counter = "false"
  77. elif (are_sure.lower() == "n" or are_sure.lower() == "no"):
  78. counter = "true"
  79. else:
  80. print("choose the number in the choices!")
  81. counter = "true"
  82. except ValueError:
  83. print ("Please read the instruction!")
  84. counter = "true"
  85. counts = "true"
  86. while (counts == "true"):
  87. try:
  88. quantity = int(input("how many set?: "))
  89. if (quantity <= 0):
  90. print ("below 0 is not acceptabe!")
  91. counts = "true"
  92. else:
  93. counts = "false"
  94. real_sure = input("are you sure?(y/n): ")
  95. if (real_sure.lower() == "y" or real_sure.lower() == "yes"):
  96. enter_quantity.append(quantity)
  97. print(enter_quantity)
  98. counts = "false"
  99. elif (real_sure.lower() == "n" or real_sure.lower() == "no"):
  100. counts = "true"
  101.  
  102. except ValueError:
  103. print("it should be number!")
  104. counts = "true"
  105. order_again = input("do you want to order again?(y/n): ")
  106. if (order_again.lower() == "y" or order_again.lower() == "yes"):
  107. count1 = "true"
  108. elif (order_again.lower() == "n" or order_again.lower() == "no"):
  109. count1 = "false"
  110.  
  111. account1 = Account()
  112. account1.stock()
  113. final_order = dict(zip(enter_item, enter_quantity))
  114. account1.getTotal(final_order)
Add Comment
Please, Sign In to add comment