0% found this document useful (0 votes)
12 views3 pages

Not Virus2

Uploaded by

delgadomarkinlo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views3 pages

Not Virus2

Uploaded by

delgadomarkinlo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

class User:

def __init__(self, username=None, password=None, router_id=None):


self.username = username
self.password = password
self.router_id = router_id

def get_username(self):
return self.username

def set_username(self, username):


if self.validate_username(username):
self.username = username
else:
print("Invalid username. Please try again.")

def get_password(self):
return self.password

def set_password(self, password):


if self.validate_password(password):
self.password = password
else:
print("Invalid password. Please try again.")

def get_router_id(self):
return self.router_id

def set_router_id(self, router_id):


if self.validate_router_id(router_id):
self.router_id = router_id
else:
print("Invalid router ID. Please try again.")

@staticmethod
def validate_username(username):
# Add your own validation logic here. For example, check if the username meets certain
criteria.
# For now, let's just check if it's a non-empty string.
return isinstance(username, str) and len(username) > 0

@staticmethod
def validate_password(password):
# Add your own validation logic here. For example, check if the password meets certain
criteria.
# For now, let's just check if it's a non-empty string.
return isinstance(password, str) and len(password) > 0

@staticmethod
def validate_router_id(router_id):
# Add your own validation logic here. For example, check if the router ID is a valid format.
# For now, let's just check if it's a non-empty string.
return isinstance(router_id, str) and len(router_id) > 0

def main():
user = User()

# Prompt for username


while not user.get_username():
username = input("Please enter your username: ")
user.set_username(username)

# Prompt for password


while not user.get_password():
password = input("Please enter your password: ")
user.set_password(password)

# Prompt for router ID


while not user.get_router_id():
router_id = input("Please enter your router ID: ")
user.set_router_id(router_id)

# Print the user's information


print(f"Username: {user.get_username()}")
print(f"Password: {user.get_password()}")
print(f"Router ID: {user.get_router_id()}")

if __name__ == "__main__":
main()

You might also like