Guest User

project

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