Please Write C Program Get Student Data Create Student Report Application Completely Defin Q43788866
Please write a C++ program to get student dataand create student report. This is an application to completelydefine the Student class and generate student report for theuser.
Each student must have the following 5 attributes (i.e.,instance variables, or fields)
- studentID # student’s ID such as 1
- lastName # student’s last name such as Doe
- firstName # student’s first name such as John
- gpa # student’s GPA such as 3.45
- phoneNumber # student’s phonenumber such as 323-415-5476
Under the Student class, you must also define__str__(self) function to return the stringrepresentation of the student record because yourstatement print( student ) wouldcall __str__(self) automatically.
Your main( ) function must use the following 3 variables withproper 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:
- keep adding a new student, and printing the new studentrecord.
- countStudents += 1 # increment thestudent count by one since we just added a new student
- update the current GPA total and GPA average properly asfollows:
totalGpa += gpa #add this student’s gpa to totalGpa
averageGpa = totalGpa /countStudents # computer current average Gpa
In your main( ) function, you must write a while(studentID != 0) : # loop to keepasking the user to enter student id, last name, first name, GPA,and phone number. Then, you print the student record nicely, andshow the current student count, total GPA, and average GPA. Youmust also print all the student records. Then, you continue askingthe user to enter next student’s data. If the new student id is0 (i.e., zero), please thank the user and stopyour program nicely.
How to store all the student records and print them nicely inyour main( ) function?
You may use the following statement to create an empty listcalled slist.
slist = [ ] # anempty list to start
You may use the following statement to add a student record toslist.
slist.append ( [sID, lastN, firstN, gpa, phone] ) # add a student record
You may use the following for loop to print all student recordsnicely.
for i in range (len ( slist ) ) :
print( slist[ i ] ) # print student i record
The output of your test case #1 must be asfollows.
========================================================================.
Welcome to the Python Game World of Dr. SimonLin! ç Must put Yourname
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-5428
You just entered the following student record:
Student ID: 1
Last Name: Doe
First Name: John
GPA: 3.0
Phone Number: 626-111-5428
========= 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-5428’]
========= END OF REPORT ====================+===========
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-5555
You just entered the following student record:
Student ID: 2
Last Name: Smith
First Name: Mary
GPA: 4.0
Phone Number: 626-222-5555
========= 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-5428’]
[2, ‘Smith’, ‘Mary’, 4.0, ‘626-222-5555’]
========= END OF REPORT ====================+===========
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-5555
You just entered the following student record:
Student ID: 3
Last Name: Stone
First Name: Joe
GPA: 2.0
Phone Number: 626-333-5555
========= 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-5428’]
[2, ‘Smith’, ‘Mary’, 4.0, ‘626-222-5555’]
[3, ‘Stone’, ‘Joe’, 2.0, ‘626-333-5555’]
========= END OF REPORT ====================+===========
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: Lo
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-5428’]
[2, ‘Smith’, ‘Mary’, 4.0, ‘626-222-5555’]
[3, ‘Stone’, ‘Joe’, 2.0, ‘626-333-5555’]
[4, ‘Lo’, ‘Steve’, 1.0, ‘626-444-4444’]
========= END OF REPORT ====================+===========
Please enter next student ID: 5
Please enter last name: Liken
Please enter first name: Pete
Please enter GPA: 3.0
Please enter phone number: 626-555-6666
You just entered the following student record:
Student ID: 5
Last Name: Liken
First Name: Pete
GPA: 3.0
Phone Number: 626-555-6666
========= 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-5428’]
[2, ‘Smith’, ‘Mary’, 4.0, ‘626-222-5555’]
[3, ‘Stone’, ‘Joe’, 2.0, ‘626-333-5555’]
[4, ‘Lo’, ‘Steve’, 1.0, ‘626-444-4444’]
[5, ‘Liken’, ‘Pete’, 3.0, ‘626-555-6666’]
========= END OF REPORT ====================+===========
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-5428’]
[2, ‘Smith’, ‘Mary’, 4.0, ‘626-222-5555’]
[3, ‘Stone’, ‘Joe’, 2.0, ‘626-333-5555’]
[4, ‘Lin’, ‘Steve’, 1.0, ‘626-444-4444’]
[5, ‘Li’, ‘Pete’, 3.0, ‘626-555-6666’]
[6, ‘Bee’, ‘Scott’, 4.0, ‘323-666-6666’]
========= END OF REPORT ====================+===========
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-5428’]
[2, ‘Smith’, ‘Mary’, 4.0, ‘626-222-5555’]
[3, ‘Stone’, ‘Joe’, 2.0, ‘626-333-5555’]
[4, ‘Lin’, ‘Steve’, 1.0, ‘626-444-4444’]
[5, ‘Li’, ‘Pete’, 3.0, ‘626-555-6666’]
[6, ‘Bee’, ‘Scott’, 4.0, ‘323-666-6666’]
[7, ‘Codd’, ‘April’, 3.8, ‘323-777-7777’]
========= END OF REPORT ====================+===========
Please enter next student ID: 0
Thank you for using program designed by “Yourname”
Expert Answer
Answer to Please write a C++ program to get student data and create student report. This is an application to completely define th…
OR