teacher has three students who have taken two tests. The teacher uses the follow
ID: 3871890 • Letter: T
Question
teacher has three students who have taken two tests. The teacher uses the following scale to assign a letter grade to a student, based on the average of his or her two test scores.
Test Score Letter Grade
90 - 100 A
80 - 89 B
70 - 79 C
60 - 69 D
0 - 59 F
Write a program that uses an array of string objects to hold the three student names, an array of three characters to hold the three students' letter grades, and three arrays of two doubles to hold each student's set of test scores.
The program should allow the user to enter each student's name and his or her two test scores. It should then calculate and display each student's average test score and a letter grade based on the average.
Store the number of students and scores in global named constants STUDENTS and SCORES. Use the constants to declare your arrays and when you process the arrays. Your arrays must NOT be global. Your program must include a function called inputData which accepts an element of the name array (passed by reference) and the corresponding array of test scores as arguments and initializes both the name and the test score array.
Explanation / Answer
#include #include using namespace std; const int NUM_TESTS = 4, STU_NUM = 5, STU_LENGTH = 20; void getNames(char [][STU_LENGTH]); //void calcAverage(); //void display(); void getScores(char [][STU_LENGTH], char [], double [][NUM_TESTS]); void findLowest(double tests[][NUM_TESTS]); int main() { char names[STU_NUM][STU_LENGTH]; double tests[STU_NUM][NUM_TESTS]; char gradeLetter[STU_NUM]; getNames(names); getScores(names,gradeLetter,tests); findLowest(tests); system("PAUSE"); return 0; } // Function that will ask for and store names void getNames(char names[][STU_LENGTH]) { for(int i=0;iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.