Starting from:

$30

CSCE 240 – Programming Assignment Six

CSCE 240 – Programming Assignment Six

Purpose
Add virtual functions to the Question, TrueFalseQuestion, ShortAnswerQuestion,
and MultipleChoiceQuestion classes from Programming Assignment 5. For this
assignment you will begin with the TrueFalseQuestion, ShortAnswerQuestion, and
MultipleChoiceQuestion class header and source files that you submitted for
assignment 5, and question.h file that was provided for assignment 5 (you will
make minor edits to the contents of question.h for this assignment).
Specifications
- Add a bool parameter to the Print function prototype in question.h. This
parameter will not be used by the function, but simply makes the function
prototype match the prototypes of the Print functions in the derived classes.
- Make the Print function virtual in the Question, TrueFalseQuestion,
ShortAnswerQuestion, and MultipleChoiceQuestion classes.
- Make the destructor for each of the Question, TrueFalseQuestion,
ShortAnswerQuestion, and MultipleChoiceQuestion classes virtual.
- Add a pure virtual CheckAnswer function to the Question class. The function
should take a string argument and return true if the answer is correct and
false if the answer is incorrect.
- Implement the virtual CheckAnswer function in the TrueFalseQuestion,
ShortAnswerQuestion, and MultipleChoiceQuestion classes.
- Add code to the end of the main function in checkstudentanswers.cc (after line
111) to read a text file with student answers and determine how many questions
the student answered correctly. Read the comments beginning on line 111 for
more details.
- You will submit question.h, truefalsequestion.h, truefalsequestion.cc,
shortanswerquestion.h, shortanswerquestion.cc, multiplechoicequestion.h,
multiplechoicequestion.cc, and checkstudentanswers.cc to the assignment in
Blackboard.
- Source files must compile and run on a computer of the instructor’s choosing
in the Linux lab (see your course syllabus for additional details).
Testing
- A makefile has been included to aid in using the class header and source
files, checkstudentanswers.cc, and checkp6.cc to compare your programs output
to the expected output for the provided samplekey.txt and samplestudent.txt
input files. To use the makefile, your program 6 directory should include:
your files: question.h, truefalsequestion.h, truefalsequestion.cc,
shortanswerquestion.h, shortanswerquestion.cc,
multiplechoicequestion.h, multiplechoicequestion.cc,
checkstudentanswers.cc
 the makefile
 the test files: checkp6.cc, samplekey.txt, and samplestudent.txt
- To run the provided tests type: make checkstudentanswers
Grade Breakdown
Style truefalsequestion.h: 0.1 point
Style truefalsequestion.cc: 0.1 point
Style shortanswerquestion.h: 0.1 point
Style shortanswerquestion.cc: 0.1 point
Style multiplechoicequestion.h: 0.2 point
Style multiplechoicequestion.cc: 0.2 point
Style checkstudentanswers.cc: 0.2 point
Documentation: 1 point
Clean compilation of truefalsequestion.cc: 0.3 point
Clean compilation of shortanswerquestion.cc: 0.3 point
Clean compilation of multiplechoicequestion.cc: 0.4 point
Clean compile/link of checkstudentanswers.cc: 1 point
Correctness of the virtual destructors: 2 points
Produces correct output with modified key and student text files: 4 points
The penalty for late program submissions is 10% per day, with no submission
accepted after 3 days.

More products