Advertisement
Crazed_Penguin1

Untitled

Jan 15th, 2016
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 16.24 KB | None | 0 0
  1. # Made by Brandon Smith and Henry Passo
  2. from random import choice
  3. from string import ascii_uppercase
  4. from string import digits
  5.  
  6. allowed_users=["ADMIN"]
  7. allowed_passwords=["admin"]
  8.  
  9. wallet=1000
  10. a=5
  11. b=5
  12. c=5
  13. d=5
  14. e=5
  15. f=5
  16. g=5
  17. h=5
  18. i=5
  19. j=5
  20. z=0
  21.  
  22. def create():
  23.     global allowed_users
  24.     global allowed_passwords
  25.     m=raw_input("Enter new Username: ")
  26.     n=raw_input("Enter new Password: ")
  27.     allowed_users.append(m)
  28.     allowed_passwords.append(n) # Function to create new account
  29.  
  30. def login():
  31.     global allowed_users
  32.     global allowed_passwords
  33.     l=0
  34.    
  35.     print "Please enter your Username and Password."
  36.     while l==0:
  37.         s=raw_input("\nUsername: ")
  38.         d=raw_input("Password: ")
  39.    
  40.         if s in allowed_users and d in allowed_passwords:
  41.             print "Thanks you for logging in. Your account balance is $1000.\n"
  42.             l=100
  43.         else:
  44.             print "Incorrect Username and/or Password."
  45.             continue # Logs in to store
  46.    
  47. while z==0:
  48.     print """
  49.    Welcome User. Select a number to begin.
  50.    
  51.    1) Create Account
  52.    2) Login
  53.    
  54.    """
  55.    
  56.     q=int(input(">"))
  57.     if q==1:
  58.         create()
  59.     elif q==2:
  60.         login()
  61.         z=z+100
  62.        
  63.     else:
  64.         print "Not an Option" # While loop for logging in
  65.  
  66.  
  67. def menu():
  68.     print """
  69.    Welcome User, to the Awesome Deluxe Computer Parts Shop. Select the Number to Begin.
  70.    \t1) Browse Selections
  71.    \t2) Leave Shop
  72.    """  # Function for Main Menu
  73.  
  74. def purchase():
  75.     global wallet
  76.     global a
  77.     global b
  78.     global c
  79.     global d
  80.     global e
  81.     global f
  82.     global g
  83.     global h
  84.     global i
  85.     global j
  86.     while wallet>0: #while loop for buying
  87.         print """
  88.    Here are the Selections we have currently. You have %d dollars left in your account.
  89.    
  90.    1) EVGA GeForce GT 740 Superclocked Single Slot 4GB DDR3 Graphics Cards 04G-P4-2744-KR (%d)
  91.    
  92.    2) Corsair Vengeance Pro 16GB 2x8GB DDR3 2400MHz PC3 19200 Desktop, Red CMY16GX3M2A2400C11R (%d)
  93.    
  94.    3) Corsair Gaming M65 RGB FPS Gaming Mouse, Aircraft-Grade Aluminum, 8200 DPI (CH-9000109-NA) (%d)
  95.    
  96.    4) Tree New Bee Cooling Pad for 15.6 - 17-Inch Laptops with Four 120mm Fans at 1200 RPM, Black (TNB-K0025) (%d)
  97.    
  98.    5) WD Blue 1TB Desktop Hard Disk Drive - 7200 RPM SATA 6 Gb/s 64MB Cache 3.5 Inch - WD10EZEX (%d)
  99.    
  100.    6) AULA LED Backlit Gaming Keyboard (3 Colorways) (%d)
  101.    
  102.    7) AMD A10-5800K APU 3.8Ghz Processor AD580KWOHJBOX (%d)
  103.    
  104.    8) NEC 55" LED 1920 x 1080 3500:1 Ultra-Narrow Bezel TileMatrix Video Wall Solution X554UNS-TMX9P (%d)
  105.    
  106.    9) Crucial Ballistix Sport 8GB Kit (4GBx2) DDR3 1600 MT/s (PC3-12800) CL9 @1.5V UDIMM 240-Pin Memory BLS2K4G3D169DS1J (%d)
  107.  
  108.    10) Nile Crocodile Lawyer's Bag (%d)
  109.    
  110.    11) I do not want to buy anything right now.
  111.  
  112.    """ %(wallet,a,b,c,d,e,f,g,h,i,j)
  113.    
  114.         p=int(input("Choose the Number to see the Selection. "))
  115.    
  116.         if p==1: # if statements for buying items
  117.             print """
  118.        EVGA GeForce GT 740 Superclocked Single Slot 4GB DDR3 Graphics Cards 04G-P4-2744-KR (%d) by EVGA
  119.        $98 (.07% tax + $11 S&H)
  120.        """
  121.             print "Are you sure you want to purchase this item for 98 dollars plus taxing and shipping costs?"
  122.        
  123.             t=raw_input(">")
  124.        
  125.             if t=="yes" or t=="Yes":
  126.                 r=int(input("How many do you want? "))
  127.                 price=98*r
  128.                 tax=price*.07
  129.                 final_price=price+tax+11
  130.                 trans=(''.join(choice(ascii_uppercase+digits) for i in range(9))) #Transaction ID
  131.                 if a>0 and wallet>final_price:
  132.                     a=a-r
  133.                     wallet=wallet-final_price
  134.                     print """
  135.            Transaction ID: %s
  136.            
  137.            Total = $%d
  138.                Thanks for shopping with Us. Your new balance is $%d.
  139.            
  140.            There are %d left of this item.
  141.            
  142.            """ %(trans,final_price, wallet, a)
  143.                
  144.                 else:
  145.                     print "There is no more of this item and/or You don't have enough money. Going back to home."
  146.                
  147.             elif t=="no" or t=="No":
  148.                 print "Going Back to Menu"
  149.        
  150.         elif p==2:
  151.             print """
  152.        Corsair Vengeance Pro 16GB 2x8GB DDR3 2400MHz PC3 19200 Desktop, Red CMY16GX3M2A2400C11R
  153.        $85 (.07% tax + $11 S&H)
  154.        """
  155.             print "Are you sure you want to purchase this item for 85 dollars plus taxing and shipping costs?"
  156.        
  157.             t=raw_input(">")
  158.        
  159.             if t=="yes" or t=="Yes":
  160.                 r=int(input("How many do you want? "))
  161.                 price=85*r
  162.                 tax=price*.07
  163.                 final_price=price+tax+11
  164.                 trans=(''.join(choice(ascii_uppercase+digits) for i in range(9)))
  165.                 if b>0 and wallet>final_price:
  166.                     b=b-r
  167.                     wallet=wallet-final_price
  168.                     print """
  169.            Transaction ID: %s
  170.            
  171.            Total $%d
  172.                Thanks for shopping with Us. Your new balance is $%d.
  173.            
  174.            There are %d left of this item.
  175.            
  176.            """ %(trans,final_price, wallet, b)
  177.                
  178.                 else:
  179.                     print "There is no more of this item and/or You don't have enough money. Going back to home."
  180.                
  181.             elif t=="no" or t=="No":
  182.                 print "Going Back to Menu"
  183.        
  184.         elif p==3:
  185.             print """
  186.        Corsair Gaming M65 RGB FPS Gaming Mouse, Aircraft-Grade Aluminum, 8200 DPI (CH-9000109-NA)
  187.        $60 (.07% tax + $11 S&H)
  188.        """
  189.             print "Are you sure you want to purchase this item for 60 dollars plus taxing and shipping costs?"
  190.        
  191.             t=raw_input(">")
  192.        
  193.             if t=="yes" or t=="Yes":
  194.                 r=int(input("How many do you want? "))
  195.                 price=60*r
  196.                 tax=price*.07
  197.                 final_price=price+tax+11
  198.                 trans=(''.join(choice(ascii_uppercase+digits) for i in range(9)))
  199.                 if c>0 and wallet>final_price:
  200.                     c=c-r
  201.                     wallet=wallet-final_price
  202.                     print """
  203.            Transaction ID: %s
  204.            
  205.            Total: $%d
  206.            
  207.                Thanks for shopping with Us. Your new balance is $%d.
  208.            
  209.            There are %d left of this item.
  210.            
  211.            """ %(trans,final_price, wallet, c)
  212.                
  213.                 else:
  214.                     print "There is no more of this item and/or You don't have enough money. Going back to home."
  215.                
  216.             elif t=="no" or t=="No":
  217.                 print "Going Back to Menu"
  218.                
  219.         elif p==4:
  220.             print """
  221.        Tree New Bee Cooling Pad for 15.6 - 17-Inch Laptops with Four 120mm Fans at 1200 RPM, Black (TNB-K0025)
  222.        $23 (.07% tax + $11 S&H)
  223.        """
  224.             print "Are you sure you want to purchase this item for 23 dollars plus taxing and shipping costs?"
  225.        
  226.             t=raw_input(">")
  227.        
  228.             if t=="yes" or t=="Yes":
  229.                 r=int(input("How many do you want? "))
  230.                 price=23*r
  231.                 tax=price*.07
  232.                 final_price=price+tax+11
  233.                 trans=(''.join(choice(ascii_uppercase+digits) for i in range(9)))
  234.                 if d>0 and wallet>final_price:
  235.                     d=d-r
  236.                     wallet=wallet-final_price
  237.                     print """
  238.            Transaction ID: %s
  239.            
  240.            Total: $%d
  241.                Thanks for shopping with Us. Your new balance is $%d.
  242.            
  243.            There are %d left of this item.
  244.            
  245.            """ %(trans,final_price, wallet, d)
  246.                
  247.                 else:
  248.                     print "There is no more of this item and/or You don't have enough money. Going back to home."
  249.                
  250.             elif t=="no" or t=="No":
  251.                 print "Going Back to Menu"
  252.        
  253.         elif p==5:
  254.             print """
  255.        WD Blue 1TB Desktop Hard Disk Drive - 7200 RPM SATA 6 Gb/s 64MB Cache 3.5 Inch - WD10EZEX
  256.        $55 (.07% tax + $11 S&H)
  257.        """
  258.             print "Are you sure you want to purchase this item for 55 dollars plus taxing and shipping costs?"
  259.        
  260.             t=raw_input(">")
  261.        
  262.             if t=="yes" or t=="Yes":
  263.                 r=int(input("How many do you want? "))
  264.                 price=55*r
  265.                 tax=price*.07
  266.                 final_price=price+tax+11
  267.                 trans=(''.join(choice(ascii_uppercase+digits) for i in range(9)))
  268.                 if e>0 and wallet>final_price:
  269.                     e=e-r
  270.                     wallet=wallet-final_price
  271.                     print """
  272.            Transaction ID: %s
  273.            
  274.            Total: $%d
  275.                Thanks for shopping with Us. Your new balance is $%d.
  276.            
  277.            There are %d left of this item.
  278.            
  279.            """ %(trans,final_price, wallet, e)
  280.                
  281.                 else:
  282.                     print "There is no more of this item and/or You don't have enough money. Going back to home."
  283.                
  284.             elif t=="no" or t=="No":
  285.                 print "Going Back to Menu"
  286.        
  287.         elif p==6:
  288.             print """
  289.        AULA LED Backlit Gaming Keyboard (3 Colorways)
  290.        $20 (.07% tax + $11 S&H)
  291.        """
  292.             print "Are you sure you want to purchase this item for 20 dollars plus taxing and shipping costs?"
  293.        
  294.             t=raw_input(">")
  295.        
  296.             if t=="yes" or t=="Yes":
  297.                 r=int(input("How many do you want? "))
  298.                 price=20*r
  299.                 tax=price*.07
  300.                 final_price=price+tax+11
  301.                 trans=(''.join(choice(ascii_uppercase+digits) for i in range(9)))
  302.                 if f>0 and wallet>final_price:
  303.                     f=f-r
  304.                     wallet=wallet-final_price
  305.                     print """
  306.            Transaction ID: %s
  307.            
  308.            Total: $%d
  309.                Thanks for shopping with Us. Your new balance is $%d.
  310.            
  311.            There are %d left of this item.
  312.            
  313.            """ %(trans, final_price, wallet, f)
  314.                
  315.                 else:
  316.                     print "There is no more of this item and/or You don't have enough money. Going back to home."
  317.                
  318.             elif t=="no" or t=="No":
  319.                 print "Going Back to Menu"
  320.        
  321.         elif p==7:
  322.             print """
  323.        AMD A10-5800K APU 3.8Ghz Processor AD580KWOHJBOX
  324.        $125 (.07% tax + $11 S&H)
  325.        """
  326.             print "Are you sure you want to purchase this item for 125 dollars plus taxing and shipping costs?"
  327.        
  328.             t=raw_input(">")
  329.        
  330.             if t=="yes" or t=="Yes":
  331.                 r=int(input("How many do you want? "))
  332.                 price=125*r
  333.                 tax=price*.07
  334.                 final_price=price+tax+11
  335.                 trans=(''.join(choice(ascii_uppercase+digits) for i in range(9)))
  336.                 if g>0 and wallet>final_price:
  337.                     g=g-r
  338.                     wallet=wallet-final_price
  339.                     print """
  340.            Transaction ID: %s
  341.            
  342.            Total: $%d
  343.                Thanks for shopping with Us. Your new balance is $%d.
  344.            
  345.            There are %d left of this item.
  346.            
  347.            """ %(trans,final_price, wallet, g)
  348.                
  349.                 else:
  350.                     print "There is no more of this item and/or You don't have enough money. Going back to home."
  351.                
  352.             elif t=="no" or t=="No":
  353.                 print "Going Back to Menu"
  354.        
  355.         elif p==8:
  356.             print """
  357.        NEC 55" LED 1920 x 1080 3500:1 Ultra-Narrow Bezel TileMatrix Video Wall Solution X554UNS-TMX9P
  358.        $915 (.07% tax + $11 S&H)
  359.        """
  360.             print "Are you sure you want to purchase this item for 915 dollars plus taxing and shipping costs?"
  361.        
  362.             t=raw_input(">")
  363.        
  364.             if t=="yes" or t=="Yes":
  365.                 r=int(input("How many do you want? "))
  366.                 price=915*r
  367.                 tax=price*.07
  368.                 final_price=price+tax+11
  369.                 trans=(''.join(choice(ascii_uppercase+digits) for i in range(9)))
  370.                 if h>0 and wallet>final_price:
  371.                     h=h-r
  372.                     wallet=wallet-final_price
  373.                     print """
  374.            Transaction ID: %s
  375.            
  376.            Total: $%d
  377.                Thanks for shopping with Us. Your new balance is $%d.
  378.            
  379.            There are %d left of this item.
  380.            
  381.            """ %(trans,final_price, wallet, h)
  382.                
  383.                 else:
  384.                     print "There is no more of this item and/or You don't have enough money. Going back to home."
  385.                
  386.             elif t=="no" or t=="No":
  387.                 print "Going Back to Menu"
  388.        
  389.         elif p==9:
  390.             print """
  391.        Crucial Ballistix Sport 8GB Kit (4GBx2) DDR3 1600 MT/s (PC3-12800) CL9 @1.5V UDIMM 240-Pin Memory BLS2K4G3D169DS1J
  392.        $41 (.07% tax + $11 S&H)
  393.        """
  394.             print "Are you sure you want to purchase this item for 41 dollars plus taxing and shipping costs?"
  395.        
  396.             t=raw_input(">")
  397.        
  398.             if t=="yes" or t=="Yes":
  399.                 r=int(input("How many do you want? "))
  400.                 price=41*r
  401.                 tax=price*.07
  402.                 final_price=price+tax+11
  403.                 trans=(''.join(choice(ascii_uppercase+digits) for i in range(9)))
  404.                 if i>0 and wallet>final_price:
  405.                     i=i-r
  406.                     wallet=wallet-final_price
  407.                     print """
  408.            Transaction ID: %s
  409.            
  410.            Total: $%d
  411.                Thanks for shopping with Us. Your new balance is $%d.
  412.            
  413.            There are %d left of this item.
  414.            
  415.            """ %(trans,final_price, wallet, i)
  416.                
  417.                 else:
  418.                     print "There is no more of this item and/or You don't have enough money. Going back to home."
  419.                
  420.             elif t=="no" or t=="No":
  421.                 print "Going Back to Menu"
  422.        
  423.         elif p==10:
  424.             print """
  425.        Nile Crocodile Lawyer's Bag
  426.        $900 (.07% tax + $11 S&H)
  427.        """
  428.             print "Are you sure you want to purchase this item for 900 dollars plus taxing and shipping costs?"
  429.        
  430.             t=raw_input(">")
  431.        
  432.             if t=="yes" or t=="Yes":
  433.                 r=int(input("How many do you want? "))
  434.                 price=900*r
  435.                 tax=price*.07
  436.                 final_price=price+tax+11
  437.                 trans=(''.join(choice(ascii_uppercase+digits) for i in range(9)))
  438.                 if j>0 and wallet>final_price:
  439.                     j=j-r
  440.                     wallet=wallet-final_price
  441.                     print """
  442.            Transaction ID: %s
  443.            
  444.            Total: $%d
  445.                Thanks for shopping with Us. Your new balance is $%d.
  446.            
  447.            There are %d left of this item.
  448.            
  449.            """ %(trans,final_price, wallet, j)
  450.                
  451.                 else:
  452.                     print "There is no more of this item and/or You don't have enough money. Going back to home."
  453.                
  454.             elif t=="no" or t=="No":
  455.                 print "Going Back to Menu"
  456.                
  457.         elif p==11:
  458.             print "Ok then. Going back to Main Menu."
  459.             break
  460.        
  461.         else:
  462.             print "Not a number on the list." #Purchase Function
  463.  
  464. while True:
  465.     menu()
  466.     t=int(input(">"))
  467.     if t==1:
  468.         purchase()
  469.     elif t==2:
  470.         print "Exiting Shop. Thank you for visting us, and We hope to see you again!!?!"
  471.         break
  472.     else:
  473.         print "Not an option." # While loop for Main Menu
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement