Advertisement
Guest User

Nacheff & Kamel - FINAL PROJECT

a guest
Jan 18th, 2016
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.90 KB | None | 0 0
  1. #Greg Nacheff & Dan Kamel - 1/16/16
  2. import random #important because it gives a unique random ID
  3. a = random.choice("ABCD")*3 ##ID number
  4. b = random.choice("FGHJKLA")*2
  5. c = random.choice("123456789")*2
  6. d = random.choice("ZXCIOPRTG")*2
  7. def shop(bal): #Greg
  8. print "These are the remaining items we have."
  9. items = ["Keyboard","Mouse","Monitor","Motherboard","Computer","Graphics Card","System Fans","Computer Case","Hard Drive","Operating System"]
  10. itemsdict = {"Keyboard":20
  11. ,"Mouse": 15
  12. ,"Monitor": 80
  13. ,"Motherboard": 150
  14. ,"Computer":500
  15. ,"Graphics Card": 50
  16. ,"System Fans": 30
  17. ,"Computer Case": 30
  18. ,"Hard Drive" : 100
  19. ,"Operating System": 120} #List and values for parts
  20. itemnum = 1 #User can type a number 1-10 and tells them how much it costs and the money subtracted from their account.
  21. for thing in items: #**Very important
  22. print itemnum
  23. print thing
  24. itemnum = itemnum + 1
  25. item = raw_input("What do you want?")
  26. item = int(item)
  27. currentitem = items[item-1]
  28. if bal > itemsdict[currentitem]:
  29. print "That will cost:"
  30. print itemsdict[currentitem]
  31. bal -= itemsdict[currentitem]
  32. print "You now have $%d left in your balance:" %bal
  33. print a + b + c + d , "is your transaction ID number"
  34. return bal
  35. else: #Dan
  36. print "You dont have enough money to buy this."
  37. return bal
  38. #Greg: Starts the program, allows user to type in password
  39. print "Hi, Welcome to Amazon Prime! Everything is free 2 shipping! Sign in to your account."
  40. print "----------------------------------------------"
  41. print "Username"
  42. username = raw_input(">")
  43. print "----------------------------------------------"
  44. if username == "ADMIN":
  45. print "Password"
  46. password = raw_input(">")
  47. while password != "admin":
  48. print "Wrong password, try again"
  49. password = raw_input(">")
  50. #Greg and Dan: When user types in admin, they are signed in w/ $1K
  51. print "Thanks for logging in! Your account balance is $1000!" #Logs the user into an account
  52. print "----------------------------------------------"
  53. print "What would you like to do?"
  54. print "1) Browse Inventory"
  55. print "2) Leave"
  56. choice = raw_input(">")
  57. if choice == "1":
  58. print a + b + c + d , "Is your transaction ID number."
  59. shopping = True
  60. balance = 1000 #Numbers and functions to buy games #Greg
  61. while shopping: #Dan: While loop --> balance
  62. balance = shop(balance)
  63. yn = True
  64. while yn:
  65. print "Would you like to continue shopping? Y or N" #Gives user option to continue shopping w/ loop
  66. cont = raw_input(">")
  67. if cont == "N":
  68. shopping = False
  69. print "Thanks for your order! Have a nice day!"
  70. yn = False
  71. elif cont == "Y":
  72. yn = False
  73. else:
  74. print "Please type Y or N" #Loop allows for program to continue
  75. elif choice == "2":
  76. print "Have a nice day!"
  77. #End of Program!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement