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

Please help me out with creating this program. Instructions are in the image bel

ID: 3663443 • Letter: P

Question

Please help me out with creating this program. Instructions are in the image below and use the following input data below. It must be in C++ syntax and PLEASE DO NOT paste a previously used full solution or code that is online. I would really apprecaite an original new one or at least some of it new. Please type it or if you write it on paper or on board, make sure it is clear for me to read.

2. Write a program that reads students' names followed by their test scores. The program should output each student's name followed by the test scores and the relevant grade. It should also find and print the highest test score and the name of the students having the highest test score. Student data should be stored in a struct variable of type student Type, which has four components: studentFName and studentLName of type string, testScore of type int (testScore is between 0 and 100), and grade of type char. Suppose that the class has 20 students. Use an array of 20 components of type student Type. Your program must contain at least the following functions: a. A function to read the students' data into the array b. A function to assign the relevant grade to each student. c. A function to find the highest test score. d. A function to print the names of the students having the highest test score. Your program must output each student's name in this form: last name followed by a comma, followed by a space, followed by the first name, the name must be left justified. Moreover, other than declaring the variables and opening the input and output files, the function main should only be a collection of function calls.

Explanation / Answer

#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
using namespace std;

const int ARRAY_SIZE = 20;

struct studentType
{    
string studentFName, studentLName;
char grade;
int testScore;
}students[20];

bool openinfile(ifstream& inFile,char filename[] );
void openoutfile(ofstream& outFile,char filename[]);
int readData(ifstream& inFile, studentType students[]);
void getgrade( studentType students[],int n);
void printData(ofstream& outFile, studentType students[],intn);
void highScore( ofstream& outFile, studentTypestudents[],int n);

int main ()
{bool good;
int n;
ifstream infile;
ofstream outfile;
good=openinfile(infile,"18A.txt");
if(good)
{openoutfile(outfile,"output.txt");
n=readData ( infile, students);
getgrade(students,n);
printData(outfile,students,n);
highScore(outfile,students,n);
outfile.close();
infile.close();
}
system("pause");
return 0;
}
void openoutfile(ofstream& outFile,char filename[])
{outFile.open(filename);
}  
bool openinfile(ifstream& infile,charfilename[])   
{
infile.open (filename);
if(infile.fail())           
       { cout<<"file did notopen please check it ";
        system("pause");
        return false;
        }
return true;
}
int readData(ifstream& inFile, studentType students[])
{int n=0;
inFile>>students[n].studentFName>>students[n].studentLName>>students[n].testScore;
while(inFile)
{n++;
inFile>>students[n].studentFName>>students[n].studentLName>>students[n].testScore;
}
return n;
}
void getgrade( studentType students[],int n)
{int i;
for(i=0;i<n;i++)
   switch((int)(students[i].testScore/10))
       {case 10:
        case 9:  students[i].grade='A';
                 break;
        case 8:  students[i].grade='B';
                 break;
        case 7:  students[i].grade='C';
                 break;
        case 6:  students[i].grade='D';
                 break;
        default:  students[i].grade='F';
                 break;
       }                                                   
         
}
void printData(ofstream& out, studentType students[],int n)
{out<<"name                score       grade ";
for(int i=0;i<n;i++)
  {out<<left<<students[i].studentLName<<","<<students[i].studentFName<<" ";
   out<<students[i].testScore<<" "<<students[i].grade<<endl;
   }

}
void highScore(ofstream& out,   studentTypestudents[],int n)
{int max=0,i;
for(i=1;i<n;i++)
  if(students[i].testScore>students[max].testScore)
        max=i;
out<<"Highest test score: "<<students[max].testScore<<endl;
out<<"Students receiveing highest score:"<<endl;
for(i=0;i<n;i++)
   if(students[i].testScore==students[max].testScore)
        out<<students[i].studentLName<<","<<students[i].studentFName<<endl;
       
}