Skip to main content
eick-at moodle
  • Home
  • Calendar
  • More
You are currently using guest access
Log in
eick-at moodle
Home Calendar
Expand all Collapse all
  1. Introduction to Python programming
  2. Object-oriented Programming OOP
  3. Task: Extend class "User" to our needs

Task: Extend class "User" to our needs

Completion requirements
The previously introduced class "User" is to be refactored (changed) to our needs. The template is our CSV import file:

CSV import file

Add  the following properties (attributes) to the class User:

  • surname
  • firstname
  • dateOfBirth
  • username (later needed as login name)

with the corresponding get methods which are returning the values of the properties. (At this point of time the property schoolClass is not needed.)

The constructor assigns 3 passed strings to surname, firstname and dateOfBirth. It also assigns same string of surname to property username. Furthermore it assembles the initial password from the first character of firstname + first character of surname + dateOfBirth.

Create two objects user1 and user2 and call method getPassword() and print its return value as a test.

Draw the new UML class and object diagrams!

You are currently using guest access (Log in)
Data retention summary
Get the mobile app
Powered by Moodle