Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The program willcall the function AVG which will open and read thefile ‘STUDENT.

ID: 3617720 • Letter: T

Question

The program willcall the function AVG which will open and read thefile ‘STUDENT.DAT’ and RETURN thetotal average of the class. In the file ‘STUDENT.DAT’,each student has 3 grades for test1, test2 and final exam. Thefunction should calculate the average of each student, and displaythe name of the student and his/her average. Finally, thecumulative average of the class will be returned to the mainprogram.

Also create asubroutine STAR which prints 20stars.

Format the outputof this part such that after each student’s name and average,20 stars are displayed. This should be done using the STARsubroutine.

STUDENT.DAT

Contents

Student number (integer)

Student name (up to 10 characters) There isunderscore between the first and last names

Gender (M or F) (1 Character)

Class level (G for grad / U for undergrad) (1Character)

Test1 grade (integer)

Test2 grade (integer)

Final Exam grade (integer)

E.g.:

10103 Mary_Grice MG 95 65 75

10102 Rosey_DellF G 79 75 81

10122 John_Smith MU 82 56 79

10121 Nancy_Fran FU 65 70 88

Contents

Student number (integer)

Student name (up to 10 characters) There isunderscore between the first and last names

Gender (M or F) (1 Character)

Class level (G for grad / U for undergrad) (1Character)

Test1 grade (integer)

Test2 grade (integer)

Final Exam grade (integer)

Explanation / Answer

The program willcall the function AVG which will open and read thefile ‘STUDENT.