Question

Python: Implement all the class from the class diagram below User username:String password: String first name:String...

Python:

Implement all the class from the class diagram below

User

  • username:String
  • password: String
  • first name:String
  • middle name:String
  • last name:String
  • address:String
  • officePhone:String
  • cellphone:String
  • email:String

+ add the relevant methods

0 0
Add a comment Improve this question Transcribed image text
Answer #1
# User class definition
class User:
    # Constructor
    def __init__(self,u,p,f,m,l,a,o,c,e):
        self.username = u
        self.password = p
        self.firstname = f
        self.middlename = m
        self.lastname = l
        self.address = a
        self.officePhone = o
        self.cellphone = c
        self.email = e
    
    # Getters
    def getUserName(self):
        return self.username

    def getPassword(self):
        return self.password

    def getFirstname(self):
        return self.firstname

    def getMiddlename(self):
        return self.middlename

    def getLastname(self):
        return self.lastname

    def getAddress(self):
        return self.address

    def getOfficePhone(self):
        return self.officePhone

    def getCellphone(self):
        return self.cellphone

    def getEmail(self):
        return self.email

    # Setters
    def setUserName(self, u):
        self.username = u

    def setPassword(self, p):
        self.password = p

    def setFirstname(self, f):
        self.firstname = f

    def setMiddlename(self, m):
        self.middlename = m

    def setLastname(self, l):
        self.lastname = l

    def setAddress(self, a):
        self.address = a

    def setOfficePhone(self, o):
        self.officePhone = o

    def setCellphone(self, c):
        self.cellphone = c

    def setEmail(self, e):
        self.email = e
Add a comment
Know the answer?
Add Answer to:
Python: Implement all the class from the class diagram below User username:String password: String first name:String...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • For task 2, implement the three classes (Person, Student, and Staff) that are described above. Note...

    For task 2, implement the three classes (Person, Student, and Staff) that are described above. Note that classes Staff and Student are derived from the superclass Person -- in other words Staff and Student inherit from Person. Make sure that the subclasses Student and Staff invoke the superclass' constructors and correctly inherit the variables and methods from the superclass Person. Also note that Person is an abstract class. <abstract> Person -name:String -address:String = “String” +getName():String +getAddress():String +setAddress(address:String):void +setName(name:String):void Staff -school:String...

  • Python Implement a class named BubbleStringList. In this class implement a method called add, that when...

    Python Implement a class named BubbleStringList. In this class implement a method called add, that when given a string, it adds it to an internal list object. You can use the list object from the standard python library for the internal list. Next, implement a sort method that uses a BubbleSort to sort the list when called. Create another class called MergeStringList, that implements the same methods but uses a Merge Sort as the sorting algorithm. Create another class called...

  • 8.4 in python function that checks whether a string is a valid password. Suppose the pas...

    8.4 in python function that checks whether a string is a valid password. Suppose the pas rules are as follows: . A password must have at least eight characters - A password must consist of only letters and digits. ■ A password must contain at least two digits. Write a program that prompts the user to enter a password and displays valid password if the rules are followed or invalid password otherwise (Occurrences of a specified character) Write a function...

  • PYTHON Write a Python class which has two methods get_String and print_String. get_String accept a string...

    PYTHON Write a Python class which has two methods get_String and print_String. get_String accept a string from the user and print_String print the string in upper case

  • Using Python INST-FS-IAD-PROD.INS LAB1 Lab: Create User Account 2. get-password() #promt the user and create password, check the password fits the requirement USE the EXACT file names! Create a user...

    Using Python INST-FS-IAD-PROD.INS LAB1 Lab: Create User Account 2. get-password() #promt the user and create password, check the password fits the requirement USE the EXACT file names! Create a user login system. Your code should do the following: 3, create-user_name() #use this function to create the user name 1.Create your user database called "UD.txt", this should be in CSV format 4, write-file() #user this function to save the user name and password into "UD.txt" Deliverables: Sample: the data you saved...

  • In Java* Please implement a class called "MyPet". It is designed as shown in the following...

    In Java* Please implement a class called "MyPet". It is designed as shown in the following class diagram. Four private instance variables: name (of the type String), color (of the type String), gender (of the type char) and weight(of the type double). Three overloaded constructors: a default constructor with no argument a constructor which takes a string argument for name, and a constructor with take two strings, a char and a double for name, color, gender and weight respectively. public...

  • Lab 4: Databased Admin Tool Continued Python Objective: In the previous lab, you developed an admin tool for username an...

    Lab 4: Databased Admin Tool Continued Python Objective: In the previous lab, you developed an admin tool for username and password management. You accomplished the tasks with Dictionary or List. Here, use class to design your own data structure to accomplish a similar task. The UD.txt datafile: FIRST NAME, LAST NAME,USERNAME,PASSWORD Sam, DDal,sdd233,Pad231 Dave, Dcon,dcf987, BHYW4fw Dell, Grant,dgr803,Sb83d2d Mike, Kress,mkr212,UNNHS322 Lisa,Kate,lki065,dgw6234 Paul,Edward,ped332,9891ds Youyou,Tranten,ytr876,dsid21kk Nomi,Mhanken,nmh223,3282jd3d2 Write a program that imports the database from UD.txt, your program can search for users’ password....

  • Write a program that inputs a string from the user representing a password, and checks its...

    Write a program that inputs a string from the user representing a password, and checks its validity. A valid password must contain: -At least 1 lowercase letter (between 'a' and 'z') and 1 uppercase letter (between 'A' and 'Z'). -At least 1 digit (between '0' and '9' and not between 0 and 9). At least 1 special character (hint: use an else to count all the characters that are not letters or digits). -A minimum length 6 characters. -No spaces...

  • PLEASE DO BOTH OF THESE IN PYTHON 1) Exercise #1: Design and implement class Rectangle to...

    PLEASE DO BOTH OF THESE IN PYTHON 1) Exercise #1: Design and implement class Rectangle to represent a rectangle object. The class defines the following attributes (variables) and methods: Two Class variables of type double named height and width to represent the height and width of the rectangle. Set their default values to 1.0 in the default constructor. A non-argument constructor method to create a default rectangle. Another constructor method to create a rectangle with user-specified height and width. Python...

  • Write a Python class, Circle, constructed by a radius and two methods which will compute the...

    Write a Python class, Circle, constructed by a radius and two methods which will compute the area and the perimeter of a circle. Include the constructor and other required methods to set and get class attributes. Create instances of Circle and test all the associated methods. Write a Python class, Rectangle, constructed by length and width and a method which will compute the area of a rectangle. Include the constructor and other required methods to set and get class attributes....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT