Question: Design a C++ program that will interactively prompt for and read the name of the first input file (with key and student data) and use

Design a C++ program that will

interactively prompt for and read the name of the first input file (with key and student data) and use a filestream variable to represent the file

read the data from the input file and store the student information (ID#s, names, test answers) into an array of structs, counting the students as the data is read

reformat the names into a more conventional form

use the key to grade the exams and store each student's score in the array

interactively prompt for and read the name of an output file

write the following to the specified output file (separate each section with a blank line to improve readability)

your name, section #, assignment #

a report that displays the names of the students (alphabetically by last name) along with their ID#s and test scores (see formatting specifications and samples below)

a report that displays the class standings with ID#s and test scores (in descending order) (see formatting specifications and samples below) the standings report should include

the number of students who took the test with a label (maximum class size is 35)

the class average (2 digits to right of decimal)

the median (middle value or average of middle values if there are an even number of students, 2 digits to right of decimal)

interactively prompt for and read the name of the second input file< >write an appropriate message to indicate the start of the second input file processingwrite the test key to the output file (with label) read each integer, if it matches an ID# in the student array, write the student's name, test score, and test answers (you may reformat the test answers if you wish) with labels to the output file

if the integer does not match an ID# in the array, write an error message that includes the invalid ID# to the output file

Grading a Test Each of the questions on the test is worth 5 points. The test score is the # of correct responses multiplied by the point value of a question.

Assumptions

The first input file will not be empty. Each line in the file will be terminated by a linefeed (' '). It will be formatted as described above.

The second input file will not be empty. Each integer will be separated by whitespace. The last line in the file will be terminated by a linefeed (' ').

ID#s will be between 1 and 99.

The length of a name (first or last) will be 10 characters or less, for formatting purposes.

Requirements

The program MUST make use of functions (at least 5 meaningful functions in addition to main).

The program MUST CREATE A STRUCT DATA TYPE TO STORE STUDENT DATA AND THEN DECLARE AN ARRAY OF STRUCTS.

The program MUST PASS PARAMETERS to communicate values. No global variables are allowed.

No goto statements may be used.

Program must make use of filestream variables to represent the input and output files. Each input file may only be read one time.

When prompting for file names, the required order is: 1st input file, output file, 2nd input file.

Failure to adhere to the 6 previous requirements will result in up to a 60% deduction of assignment's point value.

Average and median (if even number of students) should be displayed with 2 digits to right of decimal.

For first report, right justify ID#s and test scores. Left justify names. Display names: last,first.

For second report (class standings), right justify ID#s and scores.

Program must include preprocessor directives for all header files used.

Program must use a static array (do not use a variable for the size of the array).

Write your own code - reread the CS 135 academic integrity policy (see syllabus) if necessary.

Struct declaration - each member (field) must be adequately described with a comment.

When a named constant and/or major variable is declared, provide a meaningful description of what it represents in the program.

For each function, clearly state what will be passed into the function and what will be passed out or returned by the function. Document important local variables. (See function documentation handout.)

Sample terminal session:

[lee@bobby keys]$ more first4five abcdabcdabcdabcdabcd 23 boNNie jOnEs ABCDabcdABCDabcdABCD 71 amy sMITH dcbaABCDabcdABCdabCaBBBB 10 mAttHeW ADams AAAAAAAAAAAA 31 BarBarA mARTINSon ABCDABCDABCDABCDABdb 19 jENNIFER schWarTz aabbcccdabcdabcdabcd 56 lArrY blaCk ABCDABCDABCDABCDaBcbbbbbbbb [lee@bobby keys]$ more second4five 56 13 10 19 -5 [lee@bobby keys]$ g++ assign05.cpp [lee@bobby keys]$ ./a.out Enter name of first input file first4five Enter the name of the output file fiveout Enter name of 2nd input file second4five [lee@bobby keys]$ more fiveout Lee Misch Assign #5 Section #10__ NAME ID# SCORE Adams,Matthew 10 15 Black,Larry 56 95 Jones,Bonnie 23 100 Martinson,Barbara 31 90 Schwartz,Jennifer 19 75 Smith,Amy 71 75 CLASS STANDINGS ID# SCORE 23 100 56 95 31 90 19 75 71 75 10 15 # of Students: 6 Class Average: 75.00 Median Score: 82.50

BEGIN STUDENT SEARCH FILE PROCESSING Test key: abcdabcdabcdabcdabcd ID#: 56 Name: Larry Black Test score: 95 Test responses: abcdabcdabcdabcdabcbbbbbbbb 13 is not a valid student ID# ID#: 10 Name: Matthew Adams Test score: 15 Test responses: aaaaaaaaaaaa ID#: 19 Name: Jennifer Schwartz Test score: 75 Test responses: aabbcccdabcdabcdabcd -5 is not a valid student ID#

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!