FileDocCategorySizeDatePackage
Exam.javaAPI DocExample1689Fri Apr 05 11:54:58 BST 2002None

Exam

public class Exam extends Observable
TestEdit application model - information about one exam

Fields Summary
private Vector
questions
the array of questions
private int
numQuestions
The number of questions this exam should have
protected String
crsName
The current course name
protected int
crsNum
The current course number
protected char
examName
the current exam (a, b, or c)
protected String
examVers
the current exam version (A.1, etc)
Constructors Summary
Exam()
Construct a new Exam

		questions = new Vector();
	
Methods Summary
voidaddQuestion(Q q)
Add a question to the list. Construct and add its QView

		questions.addElement(q);
	
public java.lang.StringgetCourseNumber()

		return Integer.toString(crsNum);
	
public java.lang.StringgetCourseTitle()

		return crsName;
	
public chargetExamName()

		return examName;
	
public java.lang.StringgetExamVers()

		return examVers;
	
public java.util.VectorgetListData()
Export the questions. There MUST be a better way!

		return questions;
	
public intgetNumQuestions()

		return questions.size();
	
QgetQuestion(int i)

		return (Q)questions.elementAt(i);
	
public voidsetCourseNumber(java.lang.String s)

		crsNum = Integer.parseInt(s);
	
public voidsetCourseTitle(java.lang.String s)

		crsName = s;
	
public voidsetExamName(char c)

		examName = c;
	
public voidsetExamVers(java.lang.String s)

		examVers = s;
	
voidsetListData(java.util.Vector v)
Install/replace the list of questions.

		for (int i=0; i<v.size(); i++)
			if (!(v.get(i) instanceof Q))
				throw new IllegalArgumentException(
					"setListData: must be a Vector of Q objects.");
		questions = v;