|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object becker.xtras.marks.SampleMarks
public final class SampleMarks
A sample class implementing the IMarks
interface. It maintains a
list of assignment marks for students and performs calculations on them.
Please see the package description for a more in-depth discussion of using this class.
Constructor Summary | |
---|---|
SampleMarks()
|
|
SampleMarks(String fileName)
|
Method Summary | |
---|---|
void |
addAssignment(String name)
Add a new assignment to the marks "spreadsheet." |
void |
addStudent(String name)
Add a new student to the marks "spreadsheet." |
String[] |
getAssignmentCalculationNames()
Get the names of the calculations provided for assignments. |
String[] |
getAssignmentNames()
Get the names of all the assignments. |
int |
getMark(String sName,
String aName)
Get a mark for a particular student and assignment. |
String[] |
getStudentCalculationNames()
Get the names of the calculations provided for students. |
String[] |
getStudentNames()
Get the names of the students. |
static void |
main(String[] args)
|
int |
performAssignmentCalculation(String calcName,
String aName)
Perform one of the calculations defined for assignments. |
int |
performStudentCalculation(String calcName,
String studentName)
Perform one of the calculations defined for students. |
void |
readFile(String fileName)
Read the marks "spreadsheet" from a file. |
void |
setMark(String sName,
String aName,
int mark)
Set the mark for a particular student and assignment |
void |
writeFile(String fileName)
Write the marks "spreadsheet" to a file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SampleMarks(String fileName)
public SampleMarks()
Method Detail |
---|
public int getMark(String sName, String aName)
IMarks
getMark
in interface IMarks
sName
- the name of the studentaName
- the name of the assignment
public void setMark(String sName, String aName, int mark)
IMarks
setMark
in interface IMarks
sName
- the name of the studentaName
- the name of the assignmentmark
- the mark to be assigned to this student for this assignmentpublic String[] getStudentNames()
IMarks
getStudentNames
in interface IMarks
public String[] getAssignmentNames()
IMarks
getAssignmentNames
in interface IMarks
public void addStudent(String name)
IMarks
addStudent
in interface IMarks
name
- the name of the new studentpublic void addAssignment(String name)
IMarks
addAssignment
in interface IMarks
name
- the name of the new assignmentpublic String[] getAssignmentCalculationNames()
IMarks
performAssignmentCalculation("Average", 0)
would return the
average of all the marks for assignment 0.
getAssignmentCalculationNames
in interface IMarks
public String[] getStudentCalculationNames()
IMarks
performStudentCalculation("Average Best Four Assignments", 5)
would (presumably) return the average of the best four marks for student 5.
getStudentCalculationNames
in interface IMarks
public int performAssignmentCalculation(String calcName, String aName)
IMarks
performAssignmentCalculation
in interface IMarks
calcName
- one of the names returned by IMarks.getAssignmentCalculationNames()
aName
- the name of the assignment
public int performStudentCalculation(String calcName, String studentName)
IMarks
performStudentCalculation
in interface IMarks
calcName
- one of the names returned by IMarks.getStudentCalculationNames()
studentName
- the name of the student
public void readFile(String fileName) throws FileNotFoundException
IMarks
readFile
in interface IMarks
fileName
- the name of the file to read
FileNotFoundException
public void writeFile(String fileName) throws FileNotFoundException
IMarks
writeFile
in interface IMarks
fileName
- the name of the file
FileNotFoundException
public static void main(String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |