Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def mainMenu():
- print("Main Menu")
- exit()
- def adminMenu():
- print("Admin Menu")
- exit()
- def userMenu():
- print("User Menu")
- exit()
- def newUser():
- userType, username, password1, password2 = "","","",""
- while True:
- userType = input("what type of user are you?\n(1) Admin\n(2) User\nType '-1' to exit to the main menu")
- if userType == "-1":
- mainMenu()
- if len(userType) > 1:
- print("\nInvalid Input!\n")
- elif usertype.isdigit() != True:
- print("\nPlease enter a number!")
- elif int(userType) <1:
- print("\nInvalid Input\n"
- else:
- break
- while True:
- username = input("\nPlease enter the username of the new user: ")
- if username == "-1":
- mainMenu()
- if len(username) > 10:
- print("\nUsername must be less than 11 characters!\n")
- elif username.isalpha() == False:
- print("\nThe username must only contain alpha!\n)
- else:
- break
- while True:
- password1 = input("\nPlease enter the password for the user: ")
- if password1 == '-1':
- mainMenu()
- if len(password1) >10:
- print("\nPassword must be less than 11 characters!\n")
- password2 = input("\nPlease enter the password again: ")
- if password2 == '-1':
- mainMenu()
- if len(password2) >10:
- print("\nPassword must be less than 11 characters!\n")
- if passwrod1 != password2:
- print("\nThe passwords do not match!\n")
- else:
- break
- username = username.lower()
- password1 = password1.lower()
- password2 = password2.lower()
- userTypeStore = str(userType).ljust(1)
- usernameStore = username.ljust(10)
- passwordStore = password1.ljust(10)
- store = open("users.txt","a")
- iStore = usernameStore + passwordStore + userTypeStore + "\n"
- store.write(iStore)
- store.close()
- print("\nNew User Created: ")
- print("\nUsertype: "+userType+"\nUsername: "+username)
- print("Password: **********")
- mainMenu()
- def newQuote():
- CARPET = 22.50
- carpetCost = 0
- GRIPPER = 1.10
- gripperCost = 0
- RATE = 65
- labour = 0
- underlayPicker = 0
- underlay = 0
- underlayCost = 0
- width = 0
- length = 0
- periMeter = 0
- squareMeter = 0
- rawMaterialsCost = 0
- totalcost = 0
- quotationCount = len(open("quotations.txt","r").readlines( ))
- quotationID = "CC"+str(quotationCount+1)
- while True:
- customerID = input("\nInput the customer ID: ")
- if len(customerID)>12:
- print("\nCustomer ID has to be less than 12 characters (5 characters House Number + 7 Characters Postcode")
- else:
- break
- while True:
- length = float(input("\nInput the total length of the room (m): "))
- if length>30:
- print("\nRoom is too long!")
- else:
- break
- while True:
- width = float(input("\nInput the total width of the room (m): "))
- if width>30:
- print("\nRoom is too wide!")
- else:
- break
- while True:
- periMeter = float(input("\nInput the total perimeter of the room (m): "))
- if periMeter>300:
- print("\nYou had better double check!")
- else:
- break
- while True:
- print("""
- #################################################################################
- # #
- # Clive's Carpets #
- # Underlay Picker #
- # #
- # Which underlay would the customer like: #
- # 1 - First Step: £5.99 per square meter #
- # 2 - Monarch: £7.99 per squere meter #
- # 3 - Royal: £60.00 per square meter #
- # #
- # 4 - Exit #
- # #
- #################################################################################
- """)
- def main():
- newUser()
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement