#ifndef SECTION_CPP #define SECTION_CPP #include "section.cpp" #endif #ifndef ANSWERKEY_CPP #define ANSWERKEY_CPP #include "AnswerKey.cpp" #endif #ifndef QUESTION_CPP #define QUESTION_CPP #include "question.cpp" #endif const int maxSections = 7; //assumed maximum number of sections class StudentTest { public: StudentTest (int code, char name[30], int testNumber); //receives and scores student exam void scoreTest (); //compares student responses with answer key of specified test code //Save results and/or student responses private: int testCode; int numberOfFiveAnswers; int numberOfFourAnswers; int numberOfGridIns; int numberOfSections; float studentScore[maxSections]; //preferably would use a linked list Section currentSection[maxSections]; AnswerKey currentAnswerKey; }; StudentTest::StudentTest (int code, char name[30], int testNumber) { testCode = code; AnswerKey currentAnswerKey(testCode); numberOfSections = currentAnswerKey.getNumberOfSections(); for(int x=0; x "less than" numberOfSections; x++) { numberOfFiveAnswers = currentAnswerKey.getNumberOfFiveAnswers(x); numberOfFourAnswers = currentAnswerKey.getNumberOfFourAnswers(x); numberOfGridIns = currentAnswerKey.getNumberOfGridIns(x); currentSection[x] = Section(numberOfFiveAnswers, numberOfFourAnswers, numberOfGridIns); } scoreTest(); //should return a score object // call function that saves results and/or student responses, send student name and test # } void StudentTest::scoreTest() { for(int x=0; x "less than" numberOfSections; x++) { for(int y=0; y "less than" numberOfFiveAnswers; y++) { if (currentSection[x].getAnswer(y) == currentAnswerKey.getAnswerXInSectionY(y, x)) //if correct get one point studentScore[x] +=1; else if (currentSection[x].getAnswer(y) != -1) //-1 means blank, lose 1/4 for wrong questions studentScore[x] -= .25; } for(int y=0; y "less than" numberOfFourAnswers; y++) { if (currentSection[x].getAnswer(numberOfFiveAnswers + y) == currentAnswerKey.getAnswerXInSectionY(numberOfFiveAnswers + y, x)) studentScore[x] +=1; else if (currentSection[x].getAnswer(numberOfFiveAnswers + y) != -1) //lose 1/3 for wrong QC's studentScore[x] -= 1/3; } for(int y=0; y "less than" numberOfGridIns; y++) { if (currentSection[x].getAnswer(numberOfFiveAnswers + numberOfFourAnswers + y) == currentAnswerKey.getAnswerXInSectionY(numberOfFiveAnswers + numberOfFourAnswers + y, x)) studentScore[x] +=1; } } // send studentScore array to answer key for use with score chart... Score object will be returned }