Quiz Grade Book

Quiz Grade Book Design
Consider the following “Problem Statement”:
The need exists for software to be used to maintain a “grade book” in which student quiz scores arerecorded. Each student is identified by a name and an identification number; the name is merely a stringvalue provided in a consistent conventional form and the identification number is merely a non-negativeinteger. Each quiz score is an integer value in the range 0 through 10.
The normal process is for all students to be added to the grade book prior to the administration of thefirst quiz. After each quiz is graded the scores of all students are recorded in the grade book. At anytime the instructor may wish to retrieve the entire recorded contents of the grade book along withcorresponding numeric averages. Likewise at any time the instructor may wish to retrieve the recordedscores and numeric average for any student individually. The instructor has the need to retrieve both theactual numeric average (i.e. mean) and an “adjusted numeric average” that eliminates the lowest, secondlowest, third-lowest, etc. scores from the computation.
Two complicating issues come to mind. The first has to do with students “adding” and “dropping” thecourse. Although rare, it is possible that a student may need to be added to the grade book after the firstquiz scores have been recorded. More likely is the case of a student “dropping” the course after havingbeen added. The second issue has to be with students who miss a quiz; the numeric score in such a case issimply 0.
The above problem statement probably raises quite a few questions. This is the nature of such statements. Theytend not to be precise nor complete enough to result in something fully useful just by themselves. Softwaredevelopment is a process that has to begin somewhere and somehow and problem statements are the typicalstarting point. It is the job of software developers to investigate what is given and through a process of inquiryformulate a design and then an implementation that meets the need.
For this assignment you are to design two instance classes, QuizGradeBook.java. andQuizzes.java.
QuizGradeBookwill provide for the representation and manipulation of an entire grade book while Quizzes will beused by QuizGradeBookto represent the quiz scores for each student. Both of these source programs areexpected to present all of the necessary “declarations” for instance data and public methods and must be “fullycommented”. Thus, in addition to the required identifying comment block at the top there must be a clear, conciseand correct comment block preceding each and every method. Note that at this point, none of the methods are toimplemented; each method is to be appropriately “stubbed” so that the files compile cleanly. Thus your focus forthis assignment is on “what” and not yet on “how”.
It is envisioned that this will be a two-phase assignment. The second phase of this assignment will require you toprovide actual implementations for both the QuizGradeBookand Quizzes classes. That phase will not begin untilwe reach the point of having a complete and workable design and possibly even a fully written client program. It isquite unlikely that the design produced by any student will be the one used for phase two. What is more likely isthat I will provide the design to be used. Still phase one of the assignment provides each of you the opportunity tothink deeply and specifically about the matter and that will pay dividends, including during phase two.

Solution

QuizGradeBook.java

importjava.util.ArrayList;

/*

* Class QuizGradeBook stores all students records

* andincapsulates operations with students list

* grading and quiz

*/

public class QuizGradeBook {

static Integer LAST_GENERATED_ID = 0;

/*

* Internal class which helps us to save student info

* Student info:

* 1. Id

* 2. Name

* 3. Instance of ‘Quizzes’ class

*/

private class StudentRecord

{

Integer id; // unique identifier of student

String  name; // students name

Quizzes quizzes; // Instance of ‘Quizzes’ class which saves student scores for each squiz

StudentRecord(String name_, Integer id_)

{

name = name_;

id = id_;

}

// method which added score to student Quizzes list

voidgradeQuiz(Integer quizId, Integer score)

{

}

// added missed Quiz to student Quizzes list

// unlike ‘0’ score ‘missed Quizzes’ don’t take into account

// for average mark calculation

voidmissQuiz(Integer quizId)

{

}

// retrive instance of Quizzes class

Quizzes getQuizzes()

{

return quizzes;

}

}

// quiz id is calculated base on ‘passedQuizzesCount’ value

Integer passedQuizzesCount;

// list of students

ArrayList<StudentRecord> students;

// add the student with specified name to grade book

public void addStudent(String name)

{

// if passedQuizzesCount more than ‘0’

// add ‘passedQuizzesCount’ missed Quizzes to student Quizzes

}

// remove student from grade book

public void dropStudent(String name)

{

// delete entry in ‘students’ list which name is ‘name’

}

// move to the next Quiz

public void nextQuiz()

{

}

// grade the student by current Quiz

public void gradeStudent(String name, Integer score)

{

}

// mark that Student miss current Quiz

public void missStudentGrading(String name)

{

}

// retrive students list

publicArrayList<StudentRecord>getStudents()

{

return students;

}

// retrive Quizzes object for selected student

public Quizzes getStudentQuizzes(String name)

{

return null;

}

} 

Quizzes.java 

importjava.util.Map;

/*

* Class incapsulates information about student gradeded quizzes and missed quizzes

*/

public class Quizzes {

// enum defines possible quiz state

// the quiz can be graded or missed

private static enumQuizState {

GRADED_SCORE, MISSED_SCORE

}

private class Quiz

{

privateQuizState state;

private Integer   score;

Quiz(QuizState state_, Integer value_)

{

state = state_;

score = value_;

}

}

private Map<Integer, Quiz> quizzes;

// average  of all graded quizzes

// missed quizzes are excluded from total sum

public double average()

{

return 0.0;

}

// sort all graded quizzes and cutt off latest ‘eliminatedScoresCount’ values

public double adjustedAverage(inteliminatedScoresCount)

{

return 0.0;

}

// add graded quiz to quizzed list

public void addGradedQuiz(Integer quizId, Integer score)

{

}

// add missed quiz to quizzed list

public void addMissedQuiz(Integer quizId)

{

}

}