Guest User

Untitled

a guest
Dec 12th, 2019
91
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def addNewStaffEH(self, other):
  2. SSN = other.getSSN()
  3. if SSN.isdigit() == False or len(SSN) != 10:
  4. flag = True
  5. while flag:
  6. print("\nInvalid social security number, please try again.")
  7. newSSN = input('Enter new SSN: ')
  8. if SSN.isdigit() and len(SSN) == 10:
  9. other.setSSN(newSSN)
  10. flag = False
  11. else:
  12. continue
  13.  
  14. name = other.getName()
  15. nameValid = self.isNameValid(name)
  16. if nameValid == False:
  17. flag = True
  18. while flag:
  19. print("\nInvalid name, please try again.")
  20. newName = input('Enter new name: ')
  21. nameValid = self.isNameValid(name)
  22. if nameValid:
  23. other.setName(newName)
  24. flag = False
  25. else:
  26. continue
  27.  
  28. address = other.getAddress()
  29. if address.isalnum() == False:
  30. flag = True
  31. while flag:
  32. print("\nInvalid address, please try again.")
  33. newAddress = input('Enter new address: ')
  34. if address.isalnum():
  35. other.setAddress(newAddress)
  36. flag = False
  37. else:
  38. continue
  39. cellPhone = other.getCellPhone()
  40. if cellPhone.isdigit() == False or len(cellPhone) != 7:
  41. flag = True
  42. while flag:
  43. print("\nInvalid cellphone, please try again.")
  44. newCellPhone = input('Enter new cellphone number: ')
  45. if newCellPhone.isdigit() and len(newCellPhone) == 7:
  46. other.setCellPhone(newCellPhone)
  47. flag = False
  48. else:
  49. continue
  50. phoneNumber = other.getPhoneNumber()
  51. if phoneNumber.isdigit() == False or len(cellPhone) != 7:
  52. flag = True
  53. while flag:
  54. print("\nInvalid phone number, please try again.")
  55. newPhone = input('Enter new phone number: ')
  56. if newPhone.isdigit() and len(newPhone) == 7:
  57. other.setPhoneNumber(newPhone)
  58. flag = False
  59. else:
  60. continue
  61. email = other.getEmail()
  62. emailValid = ErrorHandler().isEmailValid(email)
  63. if emailValid == False:
  64. flag = True
  65. while flag:
  66. print("\nInvalid email, please try again.")
  67. newEmail = input('Enter new email: ')
  68. emailValid = ErrorHandler().isEmailValid(newEmail)
  69. if emailValid:
  70. other.setEmail(newEmail)
  71. flag = False
  72. else:
  73. continue
  74. role = other.getRole()
  75. if role not in ["Pilot", "Cabincrew"]:
  76. flag = True
  77. while flag:
  78. print("\nInvalid role, please try again.")
  79. newRole = input('Enter new role: ')
  80. if role in ["Pilot", "Cabincrew"]:
  81. other.setRole(newRole)
  82. flag = False
  83. else:
  84. continue
  85. rank = other.getRank()
  86. if rank not in ["Captain", "Copilot", "Flight Service Manager", "Flight Attendant"]:
  87. flag = True
  88. while flag:
  89. print("\nInvalid rank, please try again.")
  90. newRank = ('Enter new rank: ')
  91. if rank in ["Captain", "Copilot", "Flight Service Manager", "Flight Attendant"]:
  92. other.setRank(newRank)
  93. flag = False
  94. else:
  95. continue
  96.  
  97. staff_license = other.getLicense()
  98. if staff_license.isalnum() == False:
  99. flag = True
  100. while flag:
  101. print("\nInvalid license, please try again.")
  102. newLicense = input('Enter new plane ID: ')
  103. if staff_license.isalnum():
  104. other.setLicense(newLicense)
  105. flag = False
  106. else:
  107. continue
  108. return other
RAW Paste Data