becker.xtras.marks
Interface IMarks

All Known Implementing Classes:
SampleMarks

public interface IMarks

An interface to model a "spreadsheet" recording student assignment marks.

Implementation Hints

Author:
Byron Weber Becker

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 studentName, String assignName)
          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.
 int performAssignmentCalculation(String calcName, String assignName)
          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 studentName, String assignName, int mark)
          Set the mark for a particular student and assignment
 void writeFile(String fileName)
          Write the marks "spreadsheet" to a file.
 

Method Detail

getMark

int getMark(String studentName,
            String assignName)
Get a mark for a particular student and assignment.

Parameters:
studentName - the name of the student
assignName - the name of the assignment
Returns:
the mark assigned to this student for this assignment

setMark

void setMark(String studentName,
             String assignName,
             int mark)
Set the mark for a particular student and assignment

Parameters:
studentName - the name of the student
assignName - the name of the assignment
mark - the mark to be assigned to this student for this assignment

getAssignmentNames

String[] getAssignmentNames()
Get the names of all the assignments.

Returns:
the names of all the assignments

getStudentNames

String[] getStudentNames()
Get the names of the students.

Returns:
the names of all the students.

addAssignment

void addAssignment(String name)
Add a new assignment to the marks "spreadsheet."

Parameters:
name - the name of the new assignment

addStudent

void addStudent(String name)
Add a new student to the marks "spreadsheet."

Parameters:
name - the name of the new student

getAssignmentCalculationNames

String[] getAssignmentCalculationNames()
Get the names of the calculations provided for assignments. For example, one might be "Average". Then calling performAssignmentCalculation("Average", 0) would return the average of all the marks for assignment 0.

Returns:
the names of all the calculations provided for assignments

getStudentCalculationNames

String[] getStudentCalculationNames()
Get the names of the calculations provided for students. For example, one might be "Average Best Four Assignments". Then calling performStudentCalculation("Average Best Four Assignments", 5) would (presumably) return the average of the best four marks for student 5.

Returns:
the names of all the calculations provided for students

performAssignmentCalculation

int performAssignmentCalculation(String calcName,
                                 String assignName)
Perform one of the calculations defined for assignments.

Parameters:
calcName - one of the names returned by getAssignmentCalculationNames()
assignName - the name of the assignment
Returns:
the result of the calculation

performStudentCalculation

int performStudentCalculation(String calcName,
                              String studentName)
Perform one of the calculations defined for students.

Parameters:
calcName - one of the names returned by getStudentCalculationNames()
studentName - the name of the student
Returns:
the result of the calculation

readFile

void readFile(String fileName)
              throws FileNotFoundException
Read the marks "spreadsheet" from a file.

Parameters:
fileName - the name of the file to read
Throws:
FileNotFoundException

writeFile

void writeFile(String fileName)
               throws FileNotFoundException
Write the marks "spreadsheet" to a file.

Parameters:
fileName - the name of the file
Throws:
FileNotFoundException