Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Ian and Maurice
- import random #imports the random function
- import math #imports the math function
- balance=1000 #The amount of money they start with
- balance=int(balance)
- tax=0# the amount of original tax
- tax=int(tax)
- shipping=0# the amount of original shipping
- shipping=int(shipping)
- def user_pass():
- print"Hey! Welcome to the PC parts store!"
- allowed_users=['ADMIN']# the username
- allowed_password=['admin']# the password
- username_password=raw_input("What is your username:")#asks for their username
- if username_password in allowed_users: #checks if username is there
- print"Great" #username woorks
- else:
- print "Access denied"#username does not work
- exit()
- password=raw_input("What is your password?") #if username is correct, asks password
- if password in allowed_password:#checks if their password is in the allowed passwrods
- print"Access granted"#password works
- else:
- print"Access denied"#password does not work
- exit()
- user_pass()
- def shop():
- global shipping #global for all the original functions that where said in the beging
- global balance
- global tax
- print"What would you like to do: Buy or Leave"#asks is they want to stay
- product=raw_input(">")
- if product=="Leave":# if they put leave they go
- print"Good Bye"
- exit()
- if product=="Buy":# if they say buy goes on
- print"Ok here is our inventory, and you have $1,000" #This is the inventory and shows the user what we have to buy and how much it costs
- print"1. Razer Blackwidow Chroma keyboard: $169.99"
- print"2. Razer Taipan Mouse: $79.99"
- print"3. Acer G226HQL 21.5-Inch Screen LED Monitor: $89.99"
- print"4. MSI 970 GAMING DDR3 2133 ATX AMD Motherboard: $99.99"
- print"5. Kingston ValueRAM 2GB Kit (2x1GB Modules): $19:46"
- print"6. PNY GeForce GT 730 2GB DDR3 Graphics Card: $59.99"
- print"7. Coolerguys PRO-Metal Series Dual 80mm Cooling kit with Preset Thermal Controller: $60.00"
- print"8. Thermaltake Commander MS-I Epic Edition VN400A1W2N-B No PS Mid Tower Case (Black/Red): $53.98"
- print"9. Lenovo Lenovo 300 GB Internal hard drive SAS 6Gb/s 2.5: $202.50"
- print"10. Cisco Approved MEM-FD4G - 4gb Compact Flash Disk PCMCIA for Cisco 12000 Series: $89.99"
- while balance>27.85: #the amount that is needed including tax to buy anything else
- buy=raw_input("Here is what we got, what would you like to buy:")
- if buy=='1'and balance > 188.89:#the amount required to buy the item, including tax and shipping
- balance-=169.99+(169.99*.07)+7#the shipping, the tax and original price all put together
- tax+=169.99*.07#the tax
- shipping+=73#the shipping
- print"The price of the item is $169.99." #This shows thw user cost of item and tax and shipping cost and it is repeated multiple times
- print"The tax is $11.89."
- print"The shipping cost is $7.00."
- print"That will be $188.89 "
- print"You have $%d left"%balance
- print"Your transaction ID is:"
- from random import choice#imporat a choice for the computer
- from string import ascii_uppercase#only using uppercase
- print(''.join(choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789') for i in range(12)))#the range for hte ID
- elif buy=='2'and balance>92.59:#repeated
- balance-=79.99+(79.99*.07)+7
- tax+=79.99*.07
- shipping+=7
- print"The price of the item is $79.99."
- print"The tax is $5.90."
- print"The shipping cost is $7.00."
- print"That will be $92.59"
- print"You have $%d left"%balance
- print"Your transaction ID is:"
- from random import choice
- from string import ascii_uppercase
- print(''.join(choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789') for i in range(12)))
- elif buy=='3'and balance>103.29: #repeated
- balance-=89.99+(89.99*.07)+7
- tax+=89.99*.07
- shipping+=7
- print"The price of the item is $89.99."
- print"The tax is $6.30."
- print"The shipping cost is $7.00."
- print"That will be $103.29"
- print"You have $%d left"%balance
- print"Your transaction ID is:"
- from random import choice
- from string import ascii_uppercase
- print(''.join(choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789') for i in range(12)))
- elif buy=='4'and balance>113.99:#repeated
- balance-=99.99+(99.99*.07)+7
- tax+=99.99*.07
- shipping+=7
- print"The price of the item is $99.99."
- print"The tax is $7.00."
- print"The shipping cost is $7.00."
- print"That will be $113.99"
- print"You have $%d left"%balance
- print"Your transaction ID is:"
- from random import choice
- from string import ascii_uppercase
- print(''.join(choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789') for i in range(12)))
- elif buy=='5'and balance > 27.85:#repeated
- balance-=19.49+(19.49*.07)+7
- tax+=19.49*.07
- shipping+=7
- print"The price of the item is $99.99."
- print"The tax is $1.36"
- print"The shipping cost is $7.00."
- print"That will be $27.85"
- print"You have $%d left"%balance
- print"Your transaction ID is:"
- from random import choice
- from string import ascii_uppercase
- print(''.join(choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789') for i in range(12)))
- elif buy=='6'and balance>71.19:#repeated
- balance-=59.99+(59.99*.07)+7
- tax+=59.99*.07
- shipping+=7
- print"The price of the item is $59.99."
- print"The tax is $4.20"
- print"The shipping cost is $7.00."
- print"That will be $71.19"
- print"You have $%d left"%balance
- print"Your transaction ID is:"
- from random import choice
- from string import ascii_uppercase
- print(''.join(choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789') for i in range(12)))
- elif buy=='7'and balance>71.20:#repeated
- balance-=60.00+(60.00*.07)+7
- tax+=60.00*.07
- shipping+=7
- print"The price of the item is $60.00."
- print"The tax is $4.20"
- print"The shipping cost is $7.00."
- print"That will be $71.20"
- print"You have $%d left"%balance
- print"Your transaction ID is:"
- from random import choice
- from string import ascii_uppercase
- print(''.join(choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789') for i in range(12)))
- elif buy=='8'and balance>64.76:#repeated
- balance-=53.98+(53.98*.07)+7
- tax+=53.98*.07
- shipping+=7
- print"The price of the item is $53.98."
- print"The tax is $3.78"
- print"The shipping cost is $7.00."
- print"That will be $64.76"
- print"You have $%d left"%balance
- print"Your transaction ID is:"
- from random import choice
- from string import ascii_uppercase
- print(''.join(choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789') for i in range(12)))
- elif buy=='9'and balance>223.66:#repeated
- balance-=202.50+(202.50*.07)+7
- tax+=202.50*.07
- shipping+=7
- print"The price of the item is $202.50."
- print"The tax is $14.18"
- print"The shipping cost is $7.00."
- print"That will be $223.66"
- print"You have $%d left"%balance
- print"Your transaction ID is:"
- from random import choice
- from string import ascii_uppercase
- print(''.join(choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789') for i in range(12)))
- elif buy=='10'and balance>103.29:#repeated
- balance-=89.99+(89.99*.07)+7
- tax+= 89.99*.07
- shipping+=7
- print"The price of the item is $89.99."
- print"The tax is $6.30"
- print"The shipping cost is $7.00."
- print"That will be $103.29"
- print"You have $%d left"%balance
- print"Your transaction ID is:"
- from random import choice
- from string import ascii_uppercase
- print(''.join(choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789') for i in range(12)))
- else:
- print"Good bye"
- print"You have $%d and thanks for shopping with us and have a good day."%balance #Tells the user their balance
- exit() #Exits the code
- shop()
Add Comment
Please, Sign In to add comment