Please need asap C++ Only ******************** We want to write a program to pro
ID: 3768245 • Letter: P
Question
Please need asap
C++ Only ********************
We want to write a program to process student grade information. We like to read students’ names followed by their test scores.
The program should output each student’s name followed by the test scores and the relevant grade. Data must be stored in a struct variable of type studentData which has 4 components. These components are student first name, last name, score and grade. Pick the BEST appropriate data type for each member of the struct. Assuming the class will have a maximum of 25 students, use an array that can hold 25 components of the struct type.
Include the following capabilities:
a) A function to read the data into the array. Give the user the choice to read data from the keyboard or from a data file. You can use the attached file to test your code. Of course, for testing, use your file to avoid entering data while testing.
The name of the data file must always be entered by the user (do not hard code a file name). Also, check to make sure that the given input data file exists. If the file does not exist, issue an error message to alert the user about the invalid file name. Make sure to ask the user again for the name of another file. However, terminate the program after the user has entered an incorrect file name for a total of 3 times. NOTE: the data file name can be input inside the function.
b) A function to determine the grade to each student. Use your syllabus for the letter grade assignment. Note you are not calculating averages. The letter grade is based on the given score.
c) A function to print the data using the form: first name, followed by a period, followed by the last name, followed by colon (:), followed by the test score, followed by space, dash, space, followed by the letter grade. For example, "Robert, James: 85 – B".
d) A function to determine if a given last name is found in the array. If so, display all of the data for the student with the given name. If the name is not found, display an error message. The given last name must be passed to the function. The main function should only be a collection of function calls in addition to the required declaration of variables.
C++ ONLY******
Sample output :
Example test file for input:
Duckey Donald 85
Goof Goofy 89
Brave Balto 93
Snow Smitn 93
Alice Wonderful 89
Samina Akthar 85
Simba Green 95
Donald Egger 90
Brown Deer 86
Johny Jackson 95
Greg Gupta 75
Samuel Happy 80
Danny Arora 80
Sleepy June 70
Amy Cheng 83
Shelly Malik 95
Chelsea Tomek 95
Angela Clodfelter 95
Allison Nields 95
Lance Norman 88
Explanation / Answer
#include #include #include void read( studentType A[] ); void assign(int testscore, char &grade); void highest(int testScoreONE,int testScoreTWO); using namespace std; struct studentType { string studentFName; string studentLName; int testscore; char grade; }testscore; int main() { ifstream in; in.open("Ch11_Ex1Data.txt"); studentType A[20]; cout A[i].studentLName >> A[i].testscore; } void assign ( int testScore, char& grade) { for(int i=0;i> A[i].testscore ; { if (testScore >= 90) grade = 'A'; else if ( testScore >= 80 ) grade = 'B'; else if ( testScore >= 70 ) grade = 'C'; else if ( testScore >= 60 ) grade = 'D'; else grade = 'F'; } }Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.