Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

An information system uses username and password for users authentication. The system. differentiates between three types of users: basic (regular) users, power users and administrators.

An information system uses username and password for users authentication. The system. differentiates between three types of users: basic (regular) users, power users and administrators. Consider the class hierarchy diagram below that represents the relation between user types Each user has a username and password. For security reasons the following password validity rules used: Valid passwords for basic users should be at least 8 characters long Valid passwords for power users should: be at least 8 characters long and has at least 2 digits and has at least 2 letters. Valid password for administrators should: meet all the requirements for valid passwords of power users and has at least 1 special character (non alphanumeric). Properly implement the three classes. Make sure to include the constructor for each class, the setter and getter for each instance variable the instance method __repr__ as necessary ( see output below) a proper instance method to compare two users for equality using the == operator. Two users are equal if the usernames of both objects are equal an instance method isValidPassword that returns True of the password is valid and False otherwise Properly implement the three classes such that the execution of the statements below should produce the following output: The user: abc 12345678, validity of password: True The user: xyz 1234567, validity of password: False The user: qwe 1234ABCD, validity of password: True The user: asd 1234ABC, validity of password: False The user: adm 123@ABCD, validity of password: True The user: kin 1234567, validity of password: False lst= [] lst.append (User("abc","12345678") ) lst.append (User("xyz","1234567") ) lst.append (User("qwe ","1234ABCD") ) lst.append (User("asd ","1234ABC") ) lst.append (User("adm","123@ABCD") ) lst.append (User("kin","1234567") ) for u in lst: print(The user: ",u, " validity of password: ",u.isValidPassword() )

use pythonimage text in transcribedimage text in transcribed

Exercises 1 An information system uses username and password for users' authentication. The system. differentiates between three types of users: basic (regular) users, power users and administrators. Consider the class hierarchy diagram below that represents the relation between user types Each user has a username and password. For security reasons the following password validity rules used: Valid passwords for basic users should be at least 8 characters long Valid passwords for power users should: - be at least 8 characters long and - has at least 2 digits and - has at least 2 letters. Valid password for administrators should: - meet all the requirements for valid passwords of power users and - has at least 1 special character (non alphanumeric). Properly implement the three classes. Make sure to include - the constructor for each class, - the setter and getter for each instance variable - the instance method _ repr__ as necessary ( see output below) - a proper instance method to compare two users for equality using the == operator. Two users are equal if the usernames of both objects are equal - an instance method isValidPassword that returns True of the password is valid and False otherwise Properly implement the three classes such that the execution of the statements below should produce the following output: Ist= [ ] Ist.append (User("abc","12345678")) Ist.append (User("xyz","1234567")) Ist.append (User("qwe ","1234ABCD")) Ist.append (User("asd ","1234ABC")) Ist.append (User("adm","123@ABCD")) Ist.append (User("kin","1234567")) for u in Ist: print("The user: ",u, " validity of password: ",u.isValidPassword() )

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Theory And Application Bio Science And Bio Technology International Conferences DTA And BSBT 2011 Held As Part Of The Future Generation In Computer And Information Science 258

Authors: Tai-hoon Kim ,Hojjat Adeli ,Alfredo Cuzzocrea ,Tughrul Arslan ,Yanchun Zhang ,Jianhua Ma ,Kyo-il Chung ,Siti Mariyam ,Xiaofeng Song

2011th Edition

3642271561, 978-3642271564

More Books

Students also viewed these Databases questions