Write the problem anaysis (IPO) in a table based on the c++ coding below.
1. Write the problem anaysis (IPO) in a table based on the c++ coding below.
(the image shows the question for the c++ coding)
#include <iostream>
#define STUDENTS 5
#define SCORES 4
using namespace std;
void getname(char[]);
void getscores(char[],double[]);
char calcgrade(double[],double &);
void print(char[],double[],char,double);
int main()
{
char name[STUDENTS][20],letter[STUDENTS],grade;
double s1[SCORES],s2[SCORES],s3[SCORES],s4[SCORES],s0[SCORES],avg;
getname(name[0]);
getscores(name[0],s0);
grade=calcgrade(s0,avg);
print(name[0],s0,grade,avg);
cin.ignore();
getname(name[1]);
getscores(name[1],s1);
grade=calcgrade(s1,avg);
print(name[1],s1,grade,avg);
cin.ignore();
getname(name[2]);
getscores(name[2],s2);
grade=calcgrade(s2,avg);
print(name[2],s2,grade,avg);
cin.ignore();
getname(name[3]);
getscores(name[3],s3);
grade=calcgrade(s3,avg);
print(name[3],s3,grade,avg);
cin.ignore();
getname(name[4]);
getscores(name[4],s4);
grade=calcgrade(s4,avg);
print(name[4],s4,grade,avg);
system("pause");
return 0;
}
void getname(char n[])
{
cout<<"Enter students name: ";
cin.getline(n,20);
}
void getscores(char n[],double g[])
{
cout<<"Enter tests scores for "<<n<<endl;
for(int i=0;i<SCORES;i++)
{
cout<<"Enters test score "<<i+1<<" : ";
cin>>g[i];
while(g[i]<0||g[i]>100)
{
cout<<"Invalid grade\n";
cout<<"Enter test score "<<i+1<<": ";
cin>>g[i];
}
}
}
char calcgrade(double g[],double & a)
{
int i;
double sum=0;
char grade;
for(i=0;i<SCORES;i++)
sum+=g[i];
a=sum/SCORES;
switch((int)a/10) // using integer arithmetic by dividing
{
case10: // score by 10 anything between 90 to 99 becomes 9
case9: // anything between 80 to 89 becomes 8 etc.
grade='A';
break;
case 8:
grade='B';
break;
case 7:
grade='C';
break;
case 6:
grade='D';
break;
default:
grade='F';
}
return grade;
}
void print(char n[],double g[],char l,double a)
{
cout<<"Student's name : "<<n<<endl;
cout<<"Test scores : ";
for(int i=0;i<SCORES;i++)
cout<<g[i]<<"\t";
cout<<"\nAverage score : "<<a<<endl;
cout<<"Student's grade : "<<l<<endl<<endl;
}
![A teacher has five students who have taken four tests. The teacher uses the following
grading scale to assign a letter grade to a student, based on the average of his or her
four test scores.
Test Score
Letter Grade
90-100
80-89
B.
70-79
C.
60-69
0-59
F
Write a program that uses
array of string objects to hold the five student names,
an
an array of five characters to hold the five students' Iletter grades, and five arrays of
four
doubles
to
hold
each
student's
set
of
test
Scores.
The program should allow the u ser to enter each student's name and his or her four
It should then calculate and display each student's average test score and a
test scores.
letter grade based on the average.
Input Validation: Do not accept test scores less than O orgreater the 100](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F8f60ec30-6081-4c97-a969-c1fe4420fe05%2F29dacfe2-f44b-43bf-90c0-7881773084f4%2Fjg1h6n_processed.jpeg&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 2 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)