Guest User

Final Project -Justin White

a guest
Jan 11th, 2018
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.80 KB | None | 0 0
  1. import random #importing random for the trasnaction numbers
  2. import string
  3.  
  4. def store():
  5. print "-----------------------------------------------------"
  6. print "Choose an option" #allowing user to choose an option
  7. print "1) Browse our New Products"
  8. print "2) logout"
  9.  
  10. choice = raw_input(">")
  11.  
  12. if choice == "1": #input
  13. print "Here are the items in our Inventory:" #prints items for sale
  14. print "1. Microsoft - Natural Ergonomic Keyboard 4000: $30.00"
  15. print "2. Logitech - M325 Wireless Optical Mouse : $15.00"
  16. print "3. Dell - SE2717HR 27 IPS LED FHD FreeSync Monitor: $150.00"
  17. print "4. Asus - ROG STRIX H270F GAMING USB 3.1 Intel Motherboard: $120 "
  18. print "5. Intel® - Core™ i3-6100 3.7GHz Processor: $200 "
  19. print "6. PNY - XLR8 NVIDIA GeForce GTX 1050 Ti 4GB GDDR5 PCI Express 3.0 Graphics Card : $500"
  20. print "7. Targus - Dual Fan Chill Mat Cooling System: $25"
  21. print "8. CORSAIR - Carbide Series ATX Mid-Tower Case: $60"
  22. print "9. WD - My Passport 2TB External USB 3.0 Portable Hard Drive: $70"
  23. print "10. ffice 365 Home, 1-year subscription, 5 PCs/Macs (Product Key Card): $100"
  24.  
  25. #items_for_sale=['Keyboard','Mouse','Monitor','Motherboard','CPU','Graphics Card','cooling Fan','Computer Case','Hard drive','Operating Systems']
  26. credit=1000
  27.  
  28. # items_for_sale=['Keyboard','Mouse','Monitor','Motherboard','CPU','Graphics Card','cooling Fan','Computer Case','Hard drive','Operating Systems']
  29. userInput = raw_input("Enter Item Number: ")
  30. if userInput == "1":
  31. print
  32. print "You have", credit-30*1.05, "left" #tells user the amount he has left with the 5% tax added on
  33. print "Transaction ID:", ''.join([random.choice(string.ascii_letters + string.digits) for n in xrange(10)])
  34. goodbye = raw_input("Would you like to keep shopping? Enter 'Yes' or 'No'")
  35. if goodbye == "Yes":
  36. store()
  37. elif goodbye =="No":
  38. print "Thank you for shopping! Check your email for shipping details."
  39. else:
  40. print "invalid input"
  41.  
  42. #if the user enters the number 1 he will order the Keyboard
  43. elif userInput == "2":
  44. print
  45. print "You have", credit-15*1.05,"left"
  46. print "Transaction ID:", ''.join([random.choice(string.ascii_letters + string.digits) for n in xrange(10)])
  47. goodbye = raw_input("Would you like to keep shopping? Enter 'Yes' or 'No'")
  48. if goodbye == "Yes":
  49. store()
  50. elif goodbye =="No":
  51. print "Thank you for shopping! Check your email for shipping details."
  52. else:
  53. print "invalid input"
  54. #if the user enters the number 2 he will order the mouse
  55. elif userInput == "3":
  56. print
  57. print "You have", credit -150*1.05, "left"
  58. print "Transaction ID:", ''.join([random.choice(string.ascii_letters + string.digits) for n in xrange(10)])
  59. goodbye = raw_input("Would you like to keep shopping? Enter 'Yes' or 'No'")
  60. if goodbye == "Yes":
  61. store()
  62. elif goodbye =="No":
  63. print "Thank you for shopping! Check your email for shipping details."
  64. else:
  65. print "invalid input"
  66. #if the user enters the number 3 he will order the monitor
  67. elif userInput =="4":
  68. print
  69. print "You have", credit-120*1.05, "left "
  70. print "Transaction ID:", ''.join([random.choice(string.ascii_letters + string.digits) for n in xrange(10)])
  71. goodbye = raw_input("Would you like to keep shopping? Enter 'Yes' or 'No'")
  72. if goodbye == "Yes":
  73. store()
  74. elif goodbye =="No":
  75. print "Thank you for shopping! Check your email for shipping details."
  76. else:
  77. print "invalid input"
  78. #if the user enters the number 4 he will order the Mother board
  79. elif userInput =="5":
  80. print
  81. print "You have", credit-200*1.05, "left"
  82. print "Transaction ID:", ''.join([random.choice(string.ascii_letters + string.digits) for n in xrange(10)])
  83. goodbye = raw_input("Would you like to keep shopping? Enter 'Yes' or 'No'")
  84. if goodbye == "Yes":
  85. store()
  86. elif goodbye =="No":
  87. print "Thank you for shopping! Check your email for shipping details."
  88. else:
  89. print "invalid input"
  90. #if the user enters the number 5 he will order the CPU
  91. elif userInput =="6":
  92. print
  93. print "You have", credit-500*1.05, "left"
  94. print "Transaction ID:", ''.join([random.choice(string.ascii_letters + string.digits) for n in xrange(10)])
  95. goodbye = raw_input("Would you like to keep shopping? Enter 'Yes' or 'No'")
  96. if goodbye == "Yes":
  97. store()
  98. elif goodbye =="No":
  99. print "Thank you for shopping! Check your email for shipping details."
  100. else:
  101. print "invalid input"
  102. #if the user enters the number 6 he will order the Graphics Card
  103. elif userInput =="7":
  104. print
  105. print "You have", credit-25*1.05,'left'
  106. print "Transaction ID:", ''.join([random.choice(string.ascii_letters + string.digits) for n in xrange(10)])
  107. goodbye = raw_input("Would you like to keep shopping? Enter 'Yes' or 'No'")
  108. if goodbye == "Yes":
  109. store()
  110. elif goodbye =="No":
  111. print "Thank you for shopping! Check your email for shipping details."
  112. else:
  113. print "invalid input"
  114. #if the user enters the number 7 he will order the cooling fan
  115. elif userInput =="8":
  116. print
  117. print "You have", credit-60*1.05, "left"
  118. print "Transaction ID:", ''.join([random.choice(string.ascii_letters + string.digits) for n in xrange(10)])
  119. goodbye = raw_input("Would you like to keep shopping? Enter 'Yes' or 'No'")
  120. if goodbye == "Yes":
  121. store()
  122. elif goodbye =="No":
  123. print "Thank you for shopping! Check your email for shipping details."
  124. else:
  125. print "invalid input"
  126. #if the user enters the number 8 he will order the computer case
  127. elif userInput =="9":
  128. print
  129. print "You have", credit-70*1.05, "left"
  130. print "Transaction ID:", ''.join([random.choice(string.ascii_letters + string.digits) for n in xrange(10)])
  131. goodbye = raw_input("Would you like to keep shopping? Enter 'Yes' or 'No'")
  132. if goodbye == "Yes":
  133. store()
  134. elif goodbye =="No":
  135. print "Thank you for shopping! Check your email for shipping details."
  136. else:
  137. print "invalid input"
  138. #if the user enters the number 9 he will order the hard drive
  139. elif userInput =="10":
  140. print
  141. print "You have", credit-100*1.05, "left"
  142. print "Transaction ID:", ''.join([random.choice(string.ascii_letters + string.digits) for n in xrange(10)])
  143. goodbye = raw_input("Would you like to keep shopping? Enter 'Yes' or 'No' ")
  144. if goodbye == "Yes":
  145. store()
  146. elif goodbye =="No":
  147. print "Thank you for shopping! Check your email for shipping details."
  148. else:
  149. print "invalid input"
  150. #if the user enters the number 10 he will order the operating system
  151.  
  152. def password():
  153. password = raw_input("password:")
  154. if password == "admin": #user has to enter to correct password to be logged in
  155. print "You are successfully logged in. Your current account balance is .. $1000 dollars"
  156. store()
  157. else:
  158. print "wrong password"
  159. print "Welcome to J's Electronics \nPlease Login Below "
  160. username = raw_input("Username:")
  161. if username == "ADMIN": #user has to enter to correct username to be logged in
  162. print ""
  163. password()
  164. else:
  165. print "Please try again (Rember Username & Passwords are case sensitive)" #user will have to try again if they enter it wrong
Add Comment
Please, Sign In to add comment