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 pointsRead 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 cop 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.hType in the following preprocessor constant above the main: #define NAMELENGTH Define the following structure type: typedef struct studentRecord int studentID; char nameNAMELENGTH; int exam exam exam; double examAvg; char letterGrade;Final Exam Grade Roster RECORDTYPE; Function prototypes:int menu;void loadRosterFILE infile, RECORDTYPE gradeRoster, int numStudents;void processChoiceFILE infile, FILE outfile, int choice, RECORDTYPE gradeRoster, int numStudents;void displayGradeInfoRECORDTYPE gradeRoster, int numStudents;void searchRosterRECORDTYPE gradeRoster, int numStudents;void writeGradeReportFILE outfile, RECORDTYPE gradeRoster, int numStudents;char determineLetterGradedouble 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; RECORDTYPE 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 dowhile 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 Close the infile. Close the outfile.The description of the loadRoster function follows: Declare an integer variable named iDeclare integer variables named studentID, exam exam and examDeclare a string variable named studentName of size NAMELENGTH Start a for loop using i from to less than numStudents. Inside the loop do:Read the data from the infile into the studentID, studentName, exam exam and exam variables using an fscanf.Create space using malloc for one RECORDTYPE and assign it to gradeRosteriAssign 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 exams to the examAvg field of the current record. To find the average, add up all exams and divide by 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: Display contents of the roster. Search the roster. Write a grade report.Final Exam Grade Roster Quit.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
