grading
Class TestPaper

java.lang.Object
  |
  +--grading.TestPaper

public class TestPaper
extends java.lang.Object


Constructor Summary
TestPaper()
          Creates a new instance of TestPaper
TestPaper(java.lang.String nam)
          Creates a new instance of TestPaper, given name
TestPaper(java.lang.String nam, int numAnsw)
          Creates a new instance of TestPaper, given name, number of answers (answers are randomly generated)
 
Method Summary
 boolean checkNthAnswer(int n, char answ)
          Checks student's answer on Nth question angainst correct answer (answ) Should throw an exception if bad n
 boolean equals(java.lang.Object obj)
          determines if two test papers are essentially the same - take tough stance here - name and all answers must be the same
static char genRandAnsw()
          Service method for generating a random multiple choice answer
 char[] getAnswers()
          obtain whole array of student's answers
 java.lang.String getName()
          report student name
 char getNthAnswer(int n)
          reports students answer on the Nth question Should throw an exception if bad n
 int getNumAnswers()
          report number of answers student has made
 int getNumCorrect()
          report number of correct by student Assumes that Test Paper has already been checked
 int getNumIncorrect()
          report number of incorrect by student Assumes that Test Paper has already been checked
 double getPctCorrect()
          report pct correct by student Assumes that Test Paper has already been checked
 double gradeAll(char[] correctAnswers)
          Grade student's answers against correct answers, including updating stats (number correct etc)
static void main(java.lang.String[] args)
           
 void setName(java.lang.String nam)
          change student's name
 void setNthAnswer(int n, char answ)
          change student's Nth answer to given value
 java.lang.String toString()
          obtain string representation for the test paper
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TestPaper

public TestPaper()
Creates a new instance of TestPaper


TestPaper

public TestPaper(java.lang.String nam)
Creates a new instance of TestPaper, given name


TestPaper

public TestPaper(java.lang.String nam,
                 int numAnsw)
Creates a new instance of TestPaper, given name, number of answers (answers are randomly generated)

Method Detail

genRandAnsw

public static char genRandAnsw()
Service method for generating a random multiple choice answer


getName

public java.lang.String getName()
report student name


getNthAnswer

public char getNthAnswer(int n)
reports students answer on the Nth question Should throw an exception if bad n


checkNthAnswer

public boolean checkNthAnswer(int n,
                              char answ)
Checks student's answer on Nth question angainst correct answer (answ) Should throw an exception if bad n


getNumAnswers

public int getNumAnswers()
report number of answers student has made


getAnswers

public char[] getAnswers()
obtain whole array of student's answers


equals

public boolean equals(java.lang.Object obj)
determines if two test papers are essentially the same - take tough stance here - name and all answers must be the same

Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
obtain string representation for the test paper

Overrides:
toString in class java.lang.Object

setName

public void setName(java.lang.String nam)
change student's name


setNthAnswer

public void setNthAnswer(int n,
                         char answ)
change student's Nth answer to given value


getNumCorrect

public int getNumCorrect()
report number of correct by student Assumes that Test Paper has already been checked


getNumIncorrect

public int getNumIncorrect()
report number of incorrect by student Assumes that Test Paper has already been checked


getPctCorrect

public double getPctCorrect()
report pct correct by student Assumes that Test Paper has already been checked


gradeAll

public double gradeAll(char[] correctAnswers)
Grade student's answers against correct answers, including updating stats (number correct etc)


main

public static void main(java.lang.String[] args)