Question: Please write a Python program to get student data and create student report. This is an application to define the Student class and to generate

Please write a Python program to get student data and create student report. This is an application to define the Student class and to generate a detail student report for the user.

Each student must have the following 5 attributes (i.e., instance variables, properties, or fields):

  1. studentID # students ID such as 1
  2. lastName # students last name such as Doe
  3. firstName # students first name such as John
  4. gpa # students GPA such as 3.0
  5. phoneNumber # students phone number such as 626-111-1111

You must create one constructor, 5 accessors (or getters), and 5 mutators (or setters) for this Student class even though your main( ) function may not use any of those accessors or mutators. Under the Student class, you must also define __str__(self) function to return the string representation of the student record because your statement print( student ) would call __str__(self) automatically.

Your main( ) function must use the following 3 global static variables with proper initial values:

countStudents = 0 # count the total number of students being constructed

totalGpa = 0.0 # total GPA summation of all students

averageGpa = 0.0 # average GPA of all students

Your main( ) function must do all the following:

  1. keep adding a new student, and printing the new student record and the complete report.
  2. countStudents += 1 # increment the student count by one since we just added a new student
  3. update the current GPA total and GPA average properly as follows:

totalGpa += gpa # add this students gpa to totalGpa

averageGpa = totalGpa / countStudents # computer current average Gpa

In your main( ) function, you must write a while (studentID != 0) : # loop to keep asking the user to enter student id, last name, first name, GPA, and phone number. Then, you print the student record nicely, and show the current student count, total GPA, and average GPA. You must also print all the student records. Then, you continue asking the user to enter next students data. If the new student id is 0 (i.e., zero), please thank the user and stop your program nicely.

How to store all the student records and print them nicely in your main( ) function?

You may use the following statement to create an empty list called slist.

slist = [ ] # an empty student list to start

You may use the following statement to add a student record to slist.

slist.append ( [sID, lastN, firstN, gpa, phone] ) # add a student record to slist

You may use the following for loop to print all student records nicely.

for i in range (len ( slist ) ) : # for all records in slist. i = 0, 1, 2, , len(slist)-1

print( slist[ i ] ) # print i-th student record

The output of your test case #1 must look exactly as follows including the data of 7 students. You must also do test case #2 and test case #3 with different sets of data for at least five students. Each test case or test run must begin with a welcome message, and must end with a thank-you message.

Welcome to the Student Report System of Dr. Simon Lin! Must use your name

1===========================================.

Please enter first student ID: 1

Please enter last name: Doe

Please enter first name: John

Please enter GPA: 3.0

Please enter phone number: 626-111-1111

You just entered the following student record:

Student ID: 1

Last Name: Doe

First Name: John

GPA: 3.0

Phone Number: 626-111-1111

========= CURRENT REPORT OF ALL STUDENTS ===============

Current Student Count = 1

Total GPA of all students = 3.0

Average GPA of all students = 3.0

All student records are as follows:

[1, 'Doe', 'John', 3.0, '626-111-1111']

========= END OF REPORT =================================

2==========================================.

Please enter next student ID: 2

Please enter last name: Smith

Please enter first name: Mary

Please enter GPA: 4.0

Please enter phone number: 626-222-2222

You just entered the following student record:

Student ID: 2

Last Name: Smith

First Name: Mary

GPA: 4.0

Phone Number: 626-222-2222

========= CURRENT REPORT OF ALL STUDENTS ===============

Current Student Count = 2

Total GPA of all students = 7.0

Average GPA of all students = 3.5

All student records are as follows:

[1, 'Doe', 'John', 3.0, '626-111-1111']

[2, 'Smith', 'Mary', 4.0, '626-222-2222']

========= END OF REPORT =================================

3==========================================.

Please enter next student ID: 3

Please enter last name: Stone

Please enter first name: Joe

Please enter GPA: 2.0

Please enter phone number: 626-333-3333

You just entered the following student record:

Student ID: 3

Last Name: Stone

First Name: Joe

GPA: 2.0

Phone Number: 626-333-3333

========= CURRENT REPORT OF ALL STUDENTS ================

Current Student Count = 3

Total GPA of all students = 9.0

Average GPA of all students = 3.0

All student records are as follows:

[1, 'Doe', 'John', 3.0, '626-111-1111']

[2, 'Smith', 'Mary', 4.0, '626-222-2222']

[3, 'Stone', 'Joe', 2.0, '626-333-3333']

========= END OF REPORT ==================================

4===========================================.

Please enter next student ID: 4

Please enter last name: Lin

Please enter first name: Steve

Please enter GPA: 1.0

Please enter phone number: 626-444-4444

You just entered the following student record:

Student ID: 4

Last Name: Lin

First Name: Steve

GPA: 1.0

Phone Number: 626-444-4444

========= CURRENT REPORT OF ALL STUDENTS ================

Current Student Count = 4

Total GPA of all students = 10.0

Average GPA of all students = 2.5

All student records are as follows:

[1, 'Doe', 'John', 3.0, '626-111-1111']

[2, 'Smith', 'Mary', 4.0, '626-222-2222']

[3, 'Stone', 'Joe', 2.0, '626-333-3333']

[4, 'Lin', 'Steve', 1.0, '626-444-4444']

========= END OF REPORT ==================================

5===========================================.

Please enter next student ID: 5

Please enter last name: Lee

Please enter first name: Pete

Please enter GPA: 3.0

Please enter phone number: 626-555-5555

You just entered the following student record:

Student ID: 5

Last Name: Lee

First Name: Pete

GPA: 3.0

Phone Number: 626-555-5555

========= CURRENT REPORT OF ALL STUDENTS ===============

Current Student Count = 5

Total GPA of all students = 13.0

Average GPA of all students = 2.6

All student records are as follows:

[1, 'Doe', 'John', 3.0, '626-111-1111']

[2, 'Smith', 'Mary', 4.0, '626-222-2222']

[3, 'Stone', 'Joe', 2.0, '626-333-3333']

[4, 'Lin', 'Steve', 1.0, '626-444-4444']

[5, 'Lee', 'Pete', 3.0, '626-555-5555']

========= END OF REPORT =================================

6===========================================.

Please enter next student ID: 6

Please enter last name: Bee

Please enter first name: Scott

Please enter GPA: 4.0

Please enter phone number: 323-666-6666

You just entered the following student record:

Student ID: 6

Last Name: Bee

First Name: Scott

GPA: 4.0

Phone Number: 323-666-6666

========= CURRENT REPORT OF ALL STUDENTS ================

Current Student Count = 6

Total GPA of all students = 17.0

Average GPA of all students = 2.8333333333333335

All student records are as follows:

[1, 'Doe', 'John', 3.0, '626-111-1111']

[2, 'Smith', 'Mary', 4.0, '626-222-2222']

[3, 'Stone', 'Joe', 2.0, '626-333-3333']

[4, 'Lin', 'Steve', 1.0, '626-444-4444']

[5, 'Lee', 'Pete', 3.0, '626-555-5555']

[6, 'Bee', 'Scott', 4.0, '323-666-6666']

========= END OF REPORT ==================================

7===========================================.

Please enter next student ID: 7

Please enter last name: Codd

Please enter first name: April

Please enter GPA: 3.80

Please enter phone number: 323-777-7777

You just entered the following student record:

Student ID: 7

Last Name: Codd

First Name: April

GPA: 3.8

Phone Number: 323-777-7777

========= CURRENT REPORT OF ALL STUDENTS ===============

Current Student Count = 7

Total GPA of all students = 20.8

Average GPA of all students = 2.9714285714285715

All student records are as follows:

[1, 'Doe', 'John', 3.0, '626-111-1111']

[2, 'Smith', 'Mary', 4.0, '626-222-2222']

[3, 'Stone', 'Joe', 2.0, '626-333-3333']

[4, 'Lin', 'Steve', 1.0, '626-444-4444']

[5, 'Lee', 'Pete', 3.0, '626-555-5555']

[6, 'Bee', 'Scott', 4.0, '323-666-6666']

[7, 'Codd', 'April', 3.8, '323-777-7777']

========= END OF REPORT =================================

8=================================================.

Please enter next student ID: 0

9=================================================.

Thank you for using the Student Report System of Dr. Simon Lin! Must use your name

10================================================.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!