|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectbecker.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 IMarkssName - the name of the studentaName - the name of the assignment
public void setMark(String sName,
String aName,
int mark)
IMarks
setMark in interface IMarkssName - 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 IMarkspublic String[] getAssignmentNames()
IMarks
getAssignmentNames in interface IMarkspublic void addStudent(String name)
IMarks
addStudent in interface IMarksname - the name of the new studentpublic void addAssignment(String name)
IMarks
addAssignment in interface IMarksname - the name of the new assignmentpublic String[] getAssignmentCalculationNames()
IMarksperformAssignmentCalculation("Average", 0) would return the
average of all the marks for assignment 0.
getAssignmentCalculationNames in interface IMarkspublic String[] getStudentCalculationNames()
IMarksperformStudentCalculation("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 IMarkscalcName - 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 IMarkscalcName - 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 IMarksfileName - the name of the file to read
FileNotFoundException
public void writeFile(String fileName)
throws FileNotFoundException
IMarks
writeFile in interface IMarksfileName - the name of the file
FileNotFoundExceptionpublic static void main(String[] args)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||