Your task is to analyze the data file which contains the test answer key and each student's answers. To do this you will determine each student's test score and the mean for the entire class. Also you...

1 answer below »
Your task is to analyze the data file which contains the test answer key and each student's answers. To do this you will determine each student's test score and the mean for the entire class. Also you will generate a histogram using the test scores. There are exactly 25 students who took the exam.


Calculate the mean exam score as the sum of all scores divided by the number of scores, as a real number. Display the mean in your output with 2 digits of precision.
Input:
The input file is named xfile.txt, and is available from the course web site. You may hardcode this specific filename into your program. Download the file from the course web space into the appropriate folder for your program to read from most easily. The file has the following format: 1st data line: the test answer key, in columns 1 thru 30 (there are exactly 30 questions on the test) Remaining data lines: a student name on one line, followed by the test answers recorded for that student on the next line. This pattern is repeated for all 25 students. The list is in alphabetical order by student name, and all data lines contain the required information starting in column one.


BAD DATA: the only bad data you are required to check for is test answers which are not the upper case letters 'T' or 'F'. If an invalid character is found, count the invalid character as a "wrong" answer, and continue processing the data line normally. However do print an error message as part of the output table which indicates what has occurred. You may assume that the test answer key is completely valid, and so are the student names. You are required to implement a check to see if the data file has opened successfully, and if it has not, your code must terminate the program with a descriptive error message. You may use either the return function and implement a second return in main (like the return (EXIT_FAILURE) shown in class lecture), or you may use the exit function and exit from any function in the program, as shown in the same lecture.


Output:
 Echoprinted input (some of which is included in items below). A table giving the list of student names in the order they were read in, the test answers for that student, and the student's test score. This table will incorporate data error messages if needed. The mean test score. A histogram showing the number of students who received scores in the following ranges: 0 thru 5, 6 thru 10, 11 thru 15, 16 thru 20, 21 thru 25, and 25 thru 30.


Important Rules:You are required to use one-dimensional arrays to store the test answer key (a one-dimensional array of char), the student's answers (a parallel one-dimensional array of char), and the frequency counts (a one-dimensional array of int) required for the histogram.
You are required to use these core-language one-dimensional arrays and C++ string class objects in this project. You may not use any two-dimensional arrays, dynamic arrays, structs or userdefined classes on this project. You also may not use the C++ Standard Template Library classes or algorithms with the exception of using appropriate iostream classes for this program, and the C++ string class to store and work with the file name and student name string data in this program. You are required to use the typedef construct to create your array types for the exam answer arrays and for the frequency counting array.
Global variables must not be used or large point penalties will be applied
Large grade point penalties can be incurred for not setting up a modular, well designed program structure
Answered Same DayNov 05, 2021

Answer To: Your task is to analyze the data file which contains the test answer key and each student's answers....

Shivani answered on Nov 08 2021
144 Votes
#include
#include
#include
#include
using namespace std;

void print_histogram(int score)
{
    cout << "\t\t\t ";
    for (int i=1; i        cout << "*";
    return;
}
int main()
{
ifstream fileIn;
string answer_key, student_name, score_line ;
int counter=0, student_score=0, sum=0, mean_score;
    int g1=0, g2=0, g3=0, g4=0, g5=0;
bool wrong_data = false;
    fileIn.open("xfile.txt");
    if (!fileIn.is_open())
    {
        cout << "ERROR: File could not be opened.";
        cout << " Quiting the program.";
    }
    
    // Getting the answer key_com
    getline(fileIn, answer_key);
    
    cout << endl << "Student Score Table" << endl;
    cout <<...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here