Guest User

Final Project

a guest
Jan 16th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.91 KB | None | 0 0
  1. #Andrew Coyne and Alexander Agbulos
  2. import math
  3. import random
  4.  
  5. print "----------------------------"
  6. print "Welcome to MAGNUS COMPUTERS!"
  7. print "----------------------------"
  8. print "Login Information Required"
  9.  
  10. #Login Info
  11. person= ['ADMIN']
  12. password1 = ['admin']
  13. b = 1000
  14. b = int(b)
  15. t = 0
  16. s = 0
  17. t = int(t)
  18. s = int(s)
  19. bought = []
  20. it = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
  21.  
  22. def uspa():#function for Login
  23. us = raw_input('USERNAME:')
  24. if us == person[0]:
  25. pa = raw_input('PASSWORD:')
  26. if pa == password1[0]:
  27. print '\n\t\t*ACCESS GRANTED*'
  28. else:
  29. print ('Incorrect... Your Connection is Terminated\n') * 100
  30. exit()
  31. else: #if incorrect, no admittance
  32. print ('Incorrect... Your Connection is Terminated\n') * 100
  33. exit()
  34. uspa()
  35.  
  36. def store(): #function
  37. global bought
  38. global s
  39. global t
  40. global b
  41. global it
  42. print """Inventory:
  43. 1) Logitech Wireless Keyboard K360: $23.99
  44. 2) HP Wireless Mouse X3000: $7.99
  45. 3) Acer G226HQL 21.5-Inch Screen LED Monitor: $99.99
  46. 4) Micro ATX Motherboard GA-78LMT-USB3: $58.99
  47. 5) Intel Core BX80646I74790K i7-4790K Processor (8M Cache, up to 4.40 GHz): $338.15
  48. 6) MSI R7 370 GAMING 4G Graphics Card: $209.99
  49. 7) ARCTIC F8 PWM PST CO - 80mm Dual Ball Bearing Low Noise PWM Standard Case Fan with PST Feature: $9.99
  50. 8) Corsair Carbide Series 100R Mid Tower Case CC-9011075-WW: $48.99
  51. 9) WD Blue 1TB Desktop Hard Disk Drive - 7200 RPM SATA 6 Gb/s 64MB Cache 3.5 Inch:$54.99
  52. 10) Microsoft Windows 10 Home OS: $119.00
  53. ======================================================
  54. *All Purchase come with a .07% Tax and a $7 Shipping Fee*
  55. *Type 'leave' to leave*
  56. ======================================================
  57. """ #
  58. while b > 13.55:
  59. a = raw_input('Type The Number of Item You Would Like to Purchase:\n')
  60. if b > 30.67 and a== it[0]:
  61. b -= 23.99 + (23.99 * .07) + 5
  62. bought.append('Logitech Wireless Keyboard K360') #adds to the list
  63. t += 23.99 * .07 #cost of item and tax
  64. s += 5 #shipping cost
  65. print ('Your Balance is $%.2f ' % b)
  66. print 'Item Number:'
  67. from random import choice#from string, sets up Transaction ID
  68. print(''.join(choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789') for i in range(12)))
  69. elif b > 13.55 and a == it[1]:
  70. b -= 7.99 + (7.99 * .07) + 5
  71. bought.append('HP Wireless Mouse X3000: $7.99')
  72. t += 7.99 * .07 #item cost and tax
  73. s += 5 #shipping fee
  74. print ('Your Balance is $%.2f ' % b)
  75. print 'Item Number:'
  76. from random import choice#transaction ID
  77. from string import ascii_uppercase
  78. print(''.join(choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789') for i in range(12)))
  79.  
  80. elif b > 111.99 and a == it[2]:
  81. b -= 99.99 + (99.99 * .07) + 5
  82. bought.append('Acer G226HQL 21.5-Inch Screen LED Monitor') #add to the list of purchases
  83. t += 99.99 * .07 #tax included #this repeats for the rest of the items
  84. s += 5 #shipping fee #process repeats for the rest of the items
  85. print ('Your Balance is $%.2f ' % b)
  86. print 'Item Number:'
  87. from random import choice #set up Transaction ID #repeat #process repeats for rest of the items
  88. from string import ascii_uppercase
  89. print(''.join(choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789') for i in range(12)))
  90.  
  91. elif b > 68.12 and a == it[3]:
  92. b -= 58.99 + (58.99 * .07) + 5
  93. bought.append('Micro ATX Motherboard GA-78LMT-USB3: $58.99')
  94. t += 58.99 * .07
  95. s += 5
  96. print ('Your Balance is $%.2f ' % b)
  97. print 'Item Number:'
  98. from random import choice
  99. from string import ascii_uppercase
  100. print(''.join(choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789') for i in range(12)))
  101.  
  102. elif b > 366.82 and a== it[4]:
  103. b -= 338.15 + (338.15 * .07) + 5
  104. bought.append('Intel Core BX80646I74790K i7-4790K Processor (8M Cache, up to 4.40 GHz)')
  105. t += 338.15 * .07
  106. s += 5
  107. print ('Your Balance is $%.2f ' % b)
  108. print 'Item Number:'
  109. from random import choice
  110. from string import ascii_uppercase
  111. print(''.join(choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789') for i in range(12)))
  112.  
  113. elif b > 229.69 and a== it[5]:
  114. b -= 209.99 + (209.99 * .07) + 5
  115. bought.append('MSI R7 370 GAMING 4G Graphics Card')
  116. t += 209.99 * .07
  117. s += 5
  118. print ('Your Balance is $%.2f ' % b)
  119. print 'Item Number:'
  120. from random import choice
  121. from string import ascii_uppercase
  122. print(''.join(choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789') for i in range(12)))
  123.  
  124. elif b > 111.99 and a== it[6]:
  125. b -= 99.99 + (99.99 * .07) + 5
  126. bought.append('ARCTIC F8 PWM PST CO - 80mm Dual Ball Bearing Low Noise PWM Standard Case Fan with PST Feature')
  127. t += 99.99 * .07
  128. s += 5
  129. print ('Your Balance is $%.2f ' % b)
  130. print 'Item Number:'
  131. from random import choice
  132. from string import ascii_uppercase
  133. print(''.join(choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789') for i in range(12)))
  134.  
  135. elif b > 57.42 and a == it[7]:
  136. b -= 48.99 + (48.99 * .07) + 5
  137. bought.append('Corsair Carbide Series 100R Mid Tower Case CC-9011075-WW')
  138. t += 48.99 * .07
  139. s += 5
  140. print ('Your Balance is $%.2f ' % b)
  141. print 'Item Number:'
  142. from random import choice
  143. from string import ascii_uppercase
  144. print(''.join(choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789') for i in range(12)))
  145.  
  146. elif b > 63.84 and a == it[8]:
  147. b -= 54.99 + (54.99 * .07) + 5
  148. bought.append('WD Blue 1TB Desktop Hard Disk Drive - 7200 RPM SATA 6 Gb/s 64MB Cache 3.5 Inch')
  149. t += 54.99 * .07
  150. s += 5
  151. print ('Your Balance is $%.2f ' % b)
  152. print 'Item Number:'
  153. from random import choice
  154. from string import ascii_uppercase
  155. print(''.join(choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789') for i in range(12)))
  156.  
  157. elif b > 133.32 and a == it[9]:
  158. b -= 119.99 + (119.00 * .07) + 5
  159. bought.append('Microsoft Windows 10 Home OS: 119.00')
  160. t += 119.00 * .07
  161. s += 5
  162. print ('Your Balance is $%.2f ' % b)
  163. print 'Item Number:'
  164. from random import choice
  165. from string import ascii_uppercase
  166. print(''.join(choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789') for i in range(12)))
  167. elif a == 'leave':
  168. print """
  169. BYE
  170. .-. _
  171. | | / )
  172. | |/ /
  173. _|__ /_
  174. / __)-' )
  175. \ `(.-')
  176. > ._>-'
  177. / \/
  178. """
  179. print "Try Again"
  180. print 'You bought: %s' %(bought)
  181. print 'Grand total in Tax: $%.2f' %t
  182. print 'Grand total in Shiping: $%d' %s
  183. print 'Grand total: $%d' % tot
  184. exit()
  185. else:
  186. print "You either don't have enough money for the item or what you wrote is not a command"
  187. store()
  188. total_cost = int(1000 - b)
  189. print '\n\nInsufficent Funds :(\n'#calculates costs
  190. print 'You bought: %s' %(bought)
  191. print '\nGrand total in Tax: $%.2f' %t #total tax costs
  192. print 'Grand total in Shipping: $%d' %s #total costs shipping
  193. print 'Grand total: $%d' % total_cost #grand total
  194. print """
  195. THANKS FOR SHOPPING
  196. .-. _
  197. | | / )
  198. | |/ /
  199. _|__ /_
  200. / __)-' )
  201. \ `(.-')
  202. > ._>-'
  203. / \/
  204. """
Add Comment
Please, Sign In to add comment