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

sample program code ***utilize 6 one-dimensional arrays to calculate letter grad

ID: 3638443 • Letter: S

Question

sample program code
***utilize 6 one-dimensional arrays to calculate letter grades for a class based on the average of three test scores. array 1 will be of the string class to hold the last name of each student. array 2 will be of the string class to hold the first name. arrays 3,4,5 will be integer arrays to hold the test scores. array 6 will be a char array to hold the letter grade for each student. Each array will have 25 elements.
***It should load the data into the array from the .txt file. The format of the data is as follows:
Field Name     Columns Used     Data type                 Comments
Last Name           0 - 9                  string               May contain spaces
Not used              10
First Name          11 - 27               string            May contain spaces
Not used                28
Test 1 Score        29 - 30                  int
Not used                  31
Test 2 Score          32 - 33                 int
Not used                  34
Test 3 Score         35 - 36                  int
Each record is on a separate line.
***should the following functions that perform the following tasks:
1.A void-returning function that reads the data from the file into arrays for first name, last name, test 1 score, test 2 score, and test 3 score.
2.A void-returning function that calculates each student's average and assigns a letter grade to array 6 based on that average. A:90-100, B:80-89, C: 70-79, D:60-69, F: <60.
3.A char-returning function that displays a menu to the user. The menu should display the folowing options:
---Display the names, scores, and grades for all the students.
---Allows the user to search for a specific student.
---Allows the user to see a list of everyone who made a specific letter grade
---Quit the program
4.A void-returning function that processes the user's menu choice using a switch statement. The default of the switch should be used to validate the user's menu choice.
5.A void-returning function that will display the names, scores, and grades for all the students (option 1 from the menu). The output should be in columnar format. The program should pause every 10 records and wait for the user to press the enter key to continue.
6.A void-returning function that will allow the user to search for a specific student based on the student's last name (option 2 from the menu). If the requested name is not in the list, an appropriate message should be displayed.
7.A void-returning function that will display the information for all students who made a specific letter grade (option 3 from the menu). The program should prompt the user to enter which letter grade should be used. For example, if the user wants to see the information for everyone who made an 'A', the user would enter an 'A'.
8.A void-returning function that will display the information for a single student. This function should be used by the 3 previous functions for displaying information.
***continue to run until the user selects the "quit" option from the menu.
***After the user has chosen to quit the program, write the information from all 6 arrays to an output file. Ask the user what the name of the output file to be used is.
***test the output file stream after attempting to open it. If it does not open correctly, display an appropriate error message and terminte the program.

Explanation / Answer

#include using namespace std; int main () { const int MAX_ARRAY = 5; int numbers[MAX_ARRAY]; int index; int sum; // Stored values in the array. for (index = 0; index