Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / CS119 Python Programming PJ 13 – Student Report   Please write a Python program to get student data and create student report

CS119 Python Programming PJ 13 – Student Report   Please write a Python program to get student data and create student report

Computer Science

CS119 Python Programming

PJ 13 – Student Report

 

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                   # student’s ID such as                          1
    2. lastName                    # student’s last name such as               Doe
    3. firstName                   # student’s first name such as              John
    4. gpa                              # student’s GPA such as                      3.0
    5. phoneNumber           # student’s 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 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 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 student’s 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================================================.

 

How to submit your Project Assignment (PJ)?

(1) Each program must be well documented with block comments and proper line comments. 

     The beginning of each program must have a block comment to show its author, date, and purpose.

     The following is an example of block comments:

# Author:  _______________   ç  must use your full name here!

# Date:      _________                ç  must put today’s date here!

# Purpose: _______________   ç  must show the purpose of this program here!

(2) You must submit to Canvas the following two items as attachments:

       (a) Your source program (for example, CS119-PJ13.py ), and

       (b) Your WORD document (for example, CS119-PJ13-report .docx ) containing the listing of

             your Python program, and the complete output of your 3 test runs as specified.   

       You must not submit a zip file to Canvas.   

=========================================================================.

//You must delete everything above & including this line to make this your Word document to be submitted.

 

 

PJ 13 Report                         My Name: ______________

 

A. The following is my Python source program:

       // Please copy your source program into here from your Visual Studio IDE.   

       // Your code here must be in color.  You must not show screen prints here.

 

B. The following is the console output of my 3 test runs:

     // One way to copy the console output is to press Ctrl+Alt+PrtScn. 

     // Another way to copy is to use the snipping tool.  To paste the image is to press Ctrl+v.

    // The console display must not be too wide, otherwise it will be too hard to read once pasted.

     // Please make sure your console is long enough to show all your output lines to be captured.

     // Please copy your console output and paste into here:

 

 

Test Case #1:

 

Test Case #2:

 

Test Case #3:

 

 

Option 1

Low Cost Option
Download this past answer in few clicks

18.99 USD

PURCHASE SOLUTION

Already member?


Option 2

Custom new solution created by our subject matter experts

GET A QUOTE

Related Questions