Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

****Python Please **** 8. Create a class named Student. The Student class should have a static variable, numStudent, and five instance variables. ( 30 pts)

****Python Please ****

image text in transcribedimage text in transcribed

8. Create a class named Student. The Student class should have a static variable, numStudent, and five instance variables. ( 30 pts) Write the following variables: Static variable - num_student: the number of the student objects that have been created, static, int, initial value =0. Instance variables name: the student's full name, string, e.g., "John Doe", must be specified when instantiated. id: the student's id, string, created based on num_student, e.g., the first student object's id should be " 1 ", the second student object's id should be " 2 ". major: the student's major, string, its default value is "Undeclared", can also be specified when instantiated. gpa: the student's current gpa, float, initial value =0.0. username: string, each student is assigned an automatically generated username following the rules below: - Get the first letter of the student's first name. - Get the first five letters of the student's last name. If student's last name is less than the required number of letters in length, then use the entire name. - Get the student's id. - Concatenate the three sets of letters then convert to lower case to generate the login name. Write a method called create_password() to create the password for the student. password: string, the default password is "ABC123abc!", each student can create their own password by following the rules below: A password must - Be at least 8 characters long. - Contain at least one uppercase letter and at least one lower case letter. - Contain at least one number. - Contain at least one special symbol: ! @ \# \% \&. Write a static method called verify_password(password) to verify if the given password is valid. Return True if yes, return False otherwise. The user must re-enter a different password if the specified password is not valid. Write the additional methods: - get_name() - get_id() - get_major() - get_gpa() - get_username() - get_password() - set_name(name): update a student's name - set_major(major): update a student's major - set_password(password): update a student's password. The new password needs to be verified first. Implement the following special methods so that student objects should be able to be compared by their gpa. -_____(self, other) To get called on comparison using = operator. -_____(self, other) To get called on comparison using > operator. Test cases: student1 = Student( "John Doe", "Computer Science", "Password1\%") \#\# id is 1 , username is jdoe1, password is Password1\% student2 = Student ( "Emily Johnson", "Cybersecurity") \#\# id is 2, username is ejohns2, password is "ABC123abc!" print(student1 == student2, student 1> student2, student 1

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 Fundamentals Study Guide

Authors: Dr. Sergio Pisano

1st Edition

B09K1WW84J, 979-8985115307

More Books

Students also viewed these Databases questions