Question: - Grade Roster ( 2 4 points ) Read ALL That way, you can ask me questions or correct me if I made a misMake

- Grade Roster (24 points)Read ALL That way, you can ask me questions or correct me if I made a misMake sure that you have downloaded the accompanying text file, roster.txt, and placed it in a folder that can be accessed by your program when it is running.Create a C program and save it as finalExamYourInitials.c in your cop2220 folder. (Replace YourInitials with your own initials.)The program will be designed so that it contains functions that you will write. ALL function bodies are to be written BELOW the main function but the prototypes for those functions must be written just above the main.I will NOT be specifying the algorithms for all functions in this assignment since you need to learn how to come up with these algorithms yourselves.Put your name, the date, and the words "Final Exam" as comments at the top of the program.Include the stdlib.h and the string.h header files just below the include to stdio.h.Type in the following preprocessor constant above the main: #define NAME_LENGTH 20Define the following structure type: typedef struct studentRecord { int studentID; char name[NAME_LENGTH+1]; int exam1, exam2, exam3; double examAvg; char letterGrade;Final Exam - Grade Roster} RECORD_TYPE; Function prototypes:int menu();void loadRoster(FILE * infile, RECORD_TYPE ** gradeRoster, int numStudents);void processChoice(FILE * infile, FILE * outfile, int choice, RECORD_TYPE ** gradeRoster, int numStudents);void displayGradeInfo(RECORD_TYPE ** gradeRoster, int numStudents);void searchRoster(RECORD_TYPE ** gradeRoster, int numStudents);void writeGradeReport(FILE * outfile, RECORD_TYPE ** gradeRoster, int numStudents);char determineLetterGrade(double average);The algorithm for the main function follows: (Pay attention to indentation in the algorithm.) char * infilename = "roster.txt";char * outfilename = "gradeReport.txt"; //Make sure that you DON'T have a file by that name already. If you do, change this name. FILE * infile; FILE * outfile; int numStudents; RECORD_TYPE ** gradeRoster;Attempt to open the infilename for reading. If not successful, print an error message and get out of the main function.Attempt to open the outfilename for writing. If not successful, print an error message and get out of the main function.Read the first line of the file that has an integer representing the number of data records following in the file. Read that integer into the numStudents variable.Create space for that many record pointers using malloc and assign that space to the gradeRoster variable.Call the function loadRoster and give it the parameters it needs. Declare an integer variable named choice. Start a do/while loop as follows.do:Final Exam - Grade RosterCall a function named menu and collect what it returns in the variable called choice. The function does not take any parameters.Call a function named processChoice and pass it the infile, outfile, the choice, the gradeRoster, and the numStudents in that order. This function does not return anything. while choice is not equal to 4. Close the infile. Close the outfile.The description of the loadRoster function follows: Declare an integer variable named i.Declare integer variables named studentID, exam1, exam2, and exam3.Declare a string variable named studentName of size NAME_LENGTH +1. Start a for loop using i from 0 to less than numStudents. Inside the loop do:Read the data from the infile into the studentID, studentName, exam1, exam2, and exam3 variables using an fscanf.Create space using malloc for one RECORD_TYPE and assign it to gradeRoster[i].Assign the values read in from the file to the corresponding structure that you just created. Remember that, for the student name, you need to use strcpy. Assign the average of the 3 exams to the examAvg field of the current record. (To find the average, add up all 3 exams and divide by 3.0.)Call the function named determineLetterGrade, give it the average that was just calculated, and store what it returns in the letterGrade field of the record.The description of the menu function follows: Present the user with the following menu: 1) Display contents of the roster. 2) Search the roster. 3) Write a grade report.Final Exam - Grade Roster 4) Quit.

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 Programming Questions!