Objectives

  • Demonstrate ability to create and use methods/functions in Python
  • Demonstrate ability to implement a simple class in Python
  • Demonstrate ability to add methods/functions to python classes and use these methods

Tasks

1. Create an object-oriented class (CIT383Student) for instantiating a new computer user. This class should have the following attributes: first_name, last_name, age, username and current_ password. The class should have getters and setters for each of these attributes. Include a method that generates a password for the user. The default password should be based on the first and last initials followed by the current time stamp.

2. Create a method (calcAverageAge) that accepts a list of students as a formal parameter and returns the average of their ages. This method should NOT be method of the class CIT383Student

3. Implement a method (validateAge) that validates the age of a student. For the purposes of this lab, a CIT383 student should be at least 15years and not more than 45years. If a user enters a date of birth that does not meet the above requirement, the method should keep prompting the user until a valid age is entered. This method should NOT be method of the class CIT383Student

4. Using the class and methods implemented above, write a program that accepts an integer from the user from the console. Your program should then create a number of CIT383 students. For each CIT383 student, request for the user to provide the first_name, last_name, username and age. Remember to validate each student's age (using the validateAge method). Print to the screen the list of users including their full name, age and default password. Using the calcAverage method, compute the average age of students and print out the average age of students. Student names should be displayed as First Name, Last Name

Sample Run see image.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.