Advertisement
Guest User

Untitled

a guest
Jan 27th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.78 KB | None | 0 0
  1.  
  2. def mainMenu():
  3. print("Main Menu")
  4. exit()
  5.  
  6. def adminMenu():
  7. print("Admin Menu")
  8. exit()
  9.  
  10. def userMenu():
  11. print("User Menu")
  12. exit()
  13.  
  14. def newUser():
  15.  
  16. userType, username, password1, password2 = "","","",""
  17.  
  18. while True:
  19. userType = input("what type of user are you?\n(1) Admin\n(2) User\nType '-1' to exit to the main menu")
  20. if userType == "-1":
  21. mainMenu()
  22. if len(userType) > 1:
  23. print("\nInvalid Input!\n")
  24. elif usertype.isdigit() != True:
  25. print("\nPlease enter a number!")
  26. elif int(userType) <1:
  27. print("\nInvalid Input\n"
  28. else:
  29. break
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36. while True:
  37. username = input("\nPlease enter the username of the new user: ")
  38. if username == "-1":
  39. mainMenu()
  40. if len(username) > 10:
  41. print("\nUsername must be less than 11 characters!\n")
  42. elif username.isalpha() == False:
  43. print("\nThe username must only contain alpha!\n)
  44. else:
  45. break
  46.  
  47. while True:
  48. password1 = input("\nPlease enter the password for the user: ")
  49. if password1 == '-1':
  50. mainMenu()
  51. if len(password1) >10:
  52. print("\nPassword must be less than 11 characters!\n")
  53.  
  54. password2 = input("\nPlease enter the password again: ")
  55. if password2 == '-1':
  56. mainMenu()
  57. if len(password2) >10:
  58. print("\nPassword must be less than 11 characters!\n")
  59. if passwrod1 != password2:
  60. print("\nThe passwords do not match!\n")
  61. else:
  62. break
  63.  
  64. username = username.lower()
  65.  
  66. password1 = password1.lower()
  67.  
  68. password2 = password2.lower()
  69.  
  70.  
  71. userTypeStore = str(userType).ljust(1)
  72.  
  73. usernameStore = username.ljust(10)
  74.  
  75. passwordStore = password1.ljust(10)
  76.  
  77.  
  78. store = open("users.txt","a")
  79.  
  80. iStore = usernameStore + passwordStore + userTypeStore + "\n"
  81.  
  82. store.write(iStore)
  83.  
  84. store.close()
  85.  
  86.  
  87. print("\nNew User Created: ")
  88.  
  89. print("\nUsertype: "+userType+"\nUsername: "+username)
  90.  
  91. print("Password: **********")
  92.  
  93. mainMenu()
  94.  
  95. def newQuote():
  96.  
  97. CARPET = 22.50
  98.  
  99. carpetCost = 0
  100.  
  101. GRIPPER = 1.10
  102.  
  103. gripperCost = 0
  104.  
  105. RATE = 65
  106.  
  107. labour = 0
  108.  
  109. underlayPicker = 0
  110.  
  111. underlay = 0
  112.  
  113. underlayCost = 0
  114.  
  115. width = 0
  116.  
  117. length = 0
  118.  
  119. periMeter = 0
  120.  
  121. squareMeter = 0
  122.  
  123. rawMaterialsCost = 0
  124.  
  125. totalcost = 0
  126.  
  127. quotationCount = len(open("quotations.txt","r").readlines( ))
  128.  
  129. quotationID = "CC"+str(quotationCount+1)
  130.  
  131. while True:
  132.  
  133. customerID = input("\nInput the customer ID: ")
  134.  
  135. if len(customerID)>12:
  136.  
  137. print("\nCustomer ID has to be less than 12 characters (5 characters House Number + 7 Characters Postcode")
  138.  
  139. else:
  140.  
  141. break
  142.  
  143. while True:
  144.  
  145. length = float(input("\nInput the total length of the room (m): "))
  146.  
  147. if length>30:
  148.  
  149. print("\nRoom is too long!")
  150. else:
  151. break
  152.  
  153. while True:
  154.  
  155. width = float(input("\nInput the total width of the room (m): "))
  156.  
  157. if width>30:
  158.  
  159. print("\nRoom is too wide!")
  160.  
  161. else:
  162.  
  163. break
  164.  
  165. while True:
  166.  
  167. periMeter = float(input("\nInput the total perimeter of the room (m): "))
  168.  
  169. if periMeter>300:
  170.  
  171. print("\nYou had better double check!")
  172.  
  173. else:
  174. break
  175.  
  176. while True:
  177. print("""
  178.  
  179. #################################################################################
  180. # #
  181. # Clive's Carpets #
  182. # Underlay Picker #
  183. # #
  184. # Which underlay would the customer like: #
  185. # 1 - First Step: £5.99 per square meter #
  186. # 2 - Monarch: £7.99 per squere meter #
  187. # 3 - Royal: £60.00 per square meter #
  188. # #
  189. # 4 - Exit #
  190. # #
  191. #################################################################################
  192.  
  193. """)
  194.  
  195. def main():
  196. newUser()
  197.  
  198. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement