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

Grade Book c++ program the student failed the exam. 12. Grade Book A teacher has

ID: 3859234 • Letter: G

Question

Grade Book c++ program


the student failed the exam. 12. Grade Book A teacher has five students who have taken four tests. The teacher uses the following oarlis sreis r e four test scores. Test Score 90-100 80-89 70-79 60-69 0-59 Letter Grade Write a program that uses an array of string objects to hold the five student names an array of five characters to hold the five students' letter grades, and five arrays of four 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 four test scores. It should then calculate and display each student's average test score and a letter grade based on the average. Input Validation: Do not accept test scores less than 0 or greater than 100.

Explanation / Answer

#include <iostream>

#include <string>

#include <bits/stdc++.h>

using namespace std;

int main()

{

string studentNames[4];

char studentGrade[4];

int studentMarks[4][5];

double average[4];

int sum;

int i,j;

cout<<"Enter names of students:"<<endl;

for(i=0;i<4;i++)

{

cin>>studentNames[i];

}

for(i=0;i<4;i++)

{

cout<<"Enter marks of student "<<i+1<<":"<<endl;

for(j=0;j<5;j++)

{

cin>>studentMarks[i][j];

if(studentMarks[i][j]<0 || studentMarks[i][j]>100)

{

cout<<"invalid marks please enter marks in between 1 t0 100"<<endl;

cin>>studentMarks[i][j];

}

}

}

for(i=0;i<4;i++)

{

sum=0;

for(j=0;j<5;j++)

{

sum=sum+studentMarks[i][j];

average[i]=sum/5;

}

}

for(i=0;i<4;i++)

{

if(average[i]>=90)

studentGrade[i]='A';

else if(average[i]>=80)

studentGrade[i]='B';

else if(average[i]>=70)

studentGrade[i]='C';

else if(average[i]>=60)

studentGrade[i]='D';

else

studentGrade[i]='E';

}

for(i=0;i<4;i++)

{

cout<<studentNames[i]<<" got an average of "<<average[i]<< " and his garde is "<<studentGrade[i]<<endl;

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote