Write the problem anaysis (IPO) in a table based on the c++ coding below.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

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
Transcribed Image Text: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
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY