Due: Friday April 3, 2015 (10:00pm)
100 points
The program will grade a series of exams and then print a grade report for students in a course. The big difference is that we will be writing the results to a web page and the you will be creating a class called PageWriter for that task.
The application problem is the same as before.Input: An instructor has a class of students each of whom takes a multiple-choice exam with 10 questions. For each student in the class, there is one line in the input file. The line contains the answers that student gave for the exam. The input file will have the following format:
line 1: the key for the exam (e.g.)
bccbbadbca
lines 2-n:
a set of answers. You know you are done when you get to a line with no data.
Note: You will not know in advance how many exams you have to grade and you don't need to store the exam answers in your program.Processing: The program is to read the input file and grade each exam and print out the score for that exam. You will also keep track of how many students earned each score (0-10) and print a report after the grading.
Output: Here is an example of how the output might appear.
Student Grades
student 1 - 8
student 2 - 10
student 3 - 1
etc.
Final Report
10 - 4
9 - 2
8 - 3
.
.
1 - 3
0 - 0
High Score - 10
Low Score - 1
Mean Score - 6.25
link to somewhere you want
For this class you will need to store the following information in instance variables:
The name of the output file (a string)
The title of the web page (a string)
A variable that contains the output file stream for the web page: ofstream outFile;
You will need this functionality:
1) The ability to create a PageWriter. You should pass in the name of the output file and the path to the output file. The call might look like this:
PageWriter newPage(fname, title);
2) A method to write the "start" material for a web page to the output file, including the title.
newPage.printStart(); //note that you will use the title instance variable in this function
3) The ability to print a text header ranging from H1 to H4 to the web page. Note: The first parameter should be of type int (1-4).
newPage.header(headerLevel, text);
4) A method to write the a paragraph of text to the web page.
newPage.paragraph(text); //you can consider each line of output text a paragraph
5) A method to write a hyperlink to the web page.
newPage.link(linkText, target);
6) A method to write a blank line to the web page.
newPage.blankLine();
6) A method to write a horizontal line to the web page.
newPage.horizontalLine(pctWidth, numPixels); //see the example report (max 100% width, and 10 pixels)8) A method to write the "end" material for a web page to the output file.
newPage.printEnd();
You should have a PageWriter.h and a PageWriter.cpp file., as well as the application (driver) program.
NOTES:
Upload: the zip file only, on TRACS.
Be sure to follow the style standards for the course.
Last Updated 3/24/15