A teacher has five students who have taken four tests. Theteacher uses the follo
ID: 3618958 • Letter: A
Question
A teacher has five students who have taken four tests. Theteacher uses the following grading scale to assign a letter gradeto a student, based on the average of his or her four testscores.90-100 A
80-89 B
70-79 C
60-69 D
0-59 F
Write a program that uses a two-dimensional array of characters tohold the five students names, a single dimensional array of fivecharacters to hold the five students' letter grades, and fivesingle dimensional arrays of four doubles to hold each student'sset of test scores. The program should allow the user toenter each student's name and his or her four test scores. Itshould then calculate and display each student's average test scoreand letter grade based on the average.
Explanation / Answer
please rate - thanks #include #define STUDENTS 5 #define GRADES 4 using namespace std; void getname(char[]); void getgrades(char[],double[]); char calcgrade(double[],double&); void print(char[],double[],char,double); int main() {char name[STUDENTS][20],letter[STUDENTS],grade; doubles1[GRADES],s2[GRADES],s3[GRADES],s4[GRADES],s0[GRADES],avg; getname(name[0]); getgrades(name[0],s0); grade=calcgrade(s0,avg); print(name[0],s0,grade,avg); cin.ignore(); getname(name[1]); getgrades(name[1],s1); grade=calcgrade(s1,avg); print(name[1],s1,grade,avg); cin.ignore(); getname(name[2]); getgrades(name[2],s2); grade=calcgrade(s2,avg); print(name[2],s2,grade,avg); cin.ignore(); getname(name[3]); getgrades(name[3],s3); grade=calcgrade(s3,avg); print(name[3],s3,grade,avg); cin.ignore(); getname(name[4]); getgrades(name[4],s4); grade=calcgrade(s4,avg); print(name[4],s4,grade,avg); system("pause"); return 0; } void getname(char n[]) {coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.