Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def addNewStaffEH(self, other):
- SSN = other.getSSN()
- if SSN.isdigit() == False or len(SSN) != 10:
- flag = True
- while flag:
- print("\nInvalid social security number, please try again.")
- newSSN = input('Enter new SSN: ')
- if SSN.isdigit() and len(SSN) == 10:
- other.setSSN(newSSN)
- flag = False
- else:
- continue
- name = other.getName()
- nameValid = self.isNameValid(name)
- if nameValid == False:
- flag = True
- while flag:
- print("\nInvalid name, please try again.")
- newName = input('Enter new name: ')
- nameValid = self.isNameValid(name)
- if nameValid:
- other.setName(newName)
- flag = False
- else:
- continue
- address = other.getAddress()
- if address.isalnum() == False:
- flag = True
- while flag:
- print("\nInvalid address, please try again.")
- newAddress = input('Enter new address: ')
- if address.isalnum():
- other.setAddress(newAddress)
- flag = False
- else:
- continue
- cellPhone = other.getCellPhone()
- if cellPhone.isdigit() == False or len(cellPhone) != 7:
- flag = True
- while flag:
- print("\nInvalid cellphone, please try again.")
- newCellPhone = input('Enter new cellphone number: ')
- if newCellPhone.isdigit() and len(newCellPhone) == 7:
- other.setCellPhone(newCellPhone)
- flag = False
- else:
- continue
- phoneNumber = other.getPhoneNumber()
- if phoneNumber.isdigit() == False or len(cellPhone) != 7:
- flag = True
- while flag:
- print("\nInvalid phone number, please try again.")
- newPhone = input('Enter new phone number: ')
- if newPhone.isdigit() and len(newPhone) == 7:
- other.setPhoneNumber(newPhone)
- flag = False
- else:
- continue
- email = other.getEmail()
- emailValid = ErrorHandler().isEmailValid(email)
- if emailValid == False:
- flag = True
- while flag:
- print("\nInvalid email, please try again.")
- newEmail = input('Enter new email: ')
- emailValid = ErrorHandler().isEmailValid(newEmail)
- if emailValid:
- other.setEmail(newEmail)
- flag = False
- else:
- continue
- role = other.getRole()
- if role not in ["Pilot", "Cabincrew"]:
- flag = True
- while flag:
- print("\nInvalid role, please try again.")
- newRole = input('Enter new role: ')
- if role in ["Pilot", "Cabincrew"]:
- other.setRole(newRole)
- flag = False
- else:
- continue
- rank = other.getRank()
- if rank not in ["Captain", "Copilot", "Flight Service Manager", "Flight Attendant"]:
- flag = True
- while flag:
- print("\nInvalid rank, please try again.")
- newRank = ('Enter new rank: ')
- if rank in ["Captain", "Copilot", "Flight Service Manager", "Flight Attendant"]:
- other.setRank(newRank)
- flag = False
- else:
- continue
- staff_license = other.getLicense()
- if staff_license.isalnum() == False:
- flag = True
- while flag:
- print("\nInvalid license, please try again.")
- newLicense = input('Enter new plane ID: ')
- if staff_license.isalnum():
- other.setLicense(newLicense)
- flag = False
- else:
- continue
- return other
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement