You are on page 1of 5

CS 1412-002 Project 2: Maximum 20 Points Covers: Chapters 6-10 and 13 Pseudocodes Due 10/13, beginning of lecture UML Designs

Due 10/18, beginning of lecture Source Codes Due 10/19, 3 a.m. Background: There is a course being taken by 128 students across 8 sections. Each section has exactly 16 students. In addition, there are 2 instructors who each oversee 4 sections. A 100-question multiple choice test is being given across all 8 sections. Each test question has 5 possible answers. Also, to reduce cheating, there are 4 different versions of the exam which are distributed evenly across all sections (i.e. each section has exactly 4 students taking one version of the exam). These exams will be graded against the keys dependent on which version of the exam was taken. Instructions: Construct a program containing at least the following 4 classes along with at least the following class variables and functions (there are likely to be more than what is listed): Class Exam Fields key[100][2] numberRightOverall[100] numberRightPerSection[2][4][100] Methods Exam() examWrite() Class Student Fields maxGuesses
1

keyNumber = studentNumber % 4 answers[100][3] totalCorrect grade Methods Student() studentWrite() Class Instructor Fields these are arrays whose dimensions and sizes are determined by you overallCorrect overallCorrectPerSection Methods instructorWrite() Class Course Fields these are arrays whose dimensions and sizes are determined by you numberRightOverall numberRightVersion Methods Course() courseWrite()

IMPORTANT (Why key in Exam and answers in Student are 2-dimensional arrays): The random number generator can work so well finding a match with one student answer per question and one key answer per question can be extremely difficult. It is likely all of the students will flunk with no student having more than 30 correct answers if the student is only allowed one answer per question and the key has only one answer per question.

In order to make the grade distributions more desirable and realistic, key in Exam and answers in Student are set as 2-dimensional arrays. To aid in loading the keys or students answers, you could use the following (this is from my implementation of the project):
void Exam::loadKey() { for (int i = 0; i < KEYSIZE; i++) { key[i][0] = rand() % 5; bool distinct = false; while(!distinct) { key[i][1] = rand() % 5; if (key[i][0] != key[i][1]) distinct = true; } } }

Also, to check for a correct answer, you could use the following code fragment (also from my implementation of the project):
for (int i = 0; i < KEYSIZE; i++) { bool correct = false; for (int j = 0; j < maxGuesses && !correct; j++) for (int k = 0; k < 2 && !correct; k++) { if (answers[i][j] == key[i][k]) { numberRightOverall[i]++; numberRightPerInstructor[instructorNumber][i]++; numberRightPerSection[instructorNumber][sectionNumber][i]++; numberCorrect++; correct = true; } } }

(Pardon the line that is indented differently above.)

Design Notes: These class declarations will be in header files (one header file named for each class (example: Exam.h)) and the class method implementations will be in C++ files (one .cpp file named for each class (example: Exam.cpp)). There will be a C++ source code that contains the code implementing the project that declares arrays of the above class objects (instantiates those classes). The following object arrays are: Exams object will be a 4-element array. Students object will be a 2 x 4 x 16 array. Instructors object will be a 2-element array.

NOTE: The object for Course will NOT be an array. In the main source code (the file containing main()), the random number generator will be seeded in main(). You will code srand() in main() ONCE before setting up any objects; the calls to rand() are made in the class implementation codes inside the class methods. For example, you will use rand() in the Exam constructor to generate the answers in the key. For these classes, each fields type is determined by you (for example: you may want key to be of type char or some other type). This is your choice. For studentNumber in class Student, use this formula based on the indices of the object array for Student: studentNumber = 64 * i + 16 * j + k where i is the instructor number (0 or 1), j is the section number for that instructor (0-3), and k is the student number in that section (0-15). In addition, the *Write methods (courseWrite, instructorWrite, et al) will write information to output files. The constructors for Exam will randomly generate their keys for all answers before any Student constructors are executed. When a constructor for Student is executed, a students answers will be produced via the random number generator.

Each students grade is as follows after rounding: grade >= 90: A 80 <= grade < 90: 70 <= grade < 80: 60 <= grade < 70: Otherwise: In addition: For the remainder of this course, unless instructed otherwise, UML diagrams (starting in Chapter 9) to represent the classes and its characteristics will also be drawn along with the pseudocode. Also, in order to write to files, parts of Chapter 13 will be taught before any pseudocodes are due. Writing to files in C++ is relatively similar to writing to the console and I should be able to easily show that. Also, design the C++ source code and header files for the project separate from the main code. There should be at least 2 .cpp files and at least 1 .h file. Pseudocodes will be due on 10/13 by the beginning of the lecture. Ensure you have a spare copy for your use between the 13th and the 19th. UML designs will be due on 10/18 by the beginning of the lecture. All user-generated .cpp files, .h files, and special instructions are due in the BlackBoard Assignment Drop Box by 3 a.m. on the 19th. No projects will be accepted after 3 a.m. on the 20th. NOTE: Special instructions are any details needed to either successfully compile or understand why a requirement has not been met. F B C D

You might also like