package Grades; import Visual.*; import Info.*; import Prediction.*; import Reports.*; import Assignments.*; import java.util.Collection; import java.util.List; /** * Gradebook represents a class gradebook with assignments, students, and a curve */ public abstract class GradeBook { /** * The collection that contains assignments for a class */ List assignments; /** * The collection that contains averages of each categorys grades for a class */ Collection averages; /** * The collection that contains Students for a class */ Collection students; /** * The curve of a class */ Curve curve; /** * Allows users to enter data into fields and ensures the number is within a * reasonable range and that the student exists /*@ requires roster.contains(student); ensures input.grade < 400 && input.grade > -100); */ abstract void editData(List roster, Student student, Grade input); /** * Allows users to set a curve and ensures it is a number between 0 and 100 */ /*@ requires (\forall int i; (i >= 0) && (i < cutoffs.size()) ; (cutoffs.get(i) <= 100) && (cutoffs.get(i) >= 0)); ensures (\forall int i; (i >= 0) && (i < cutoffs.size()) ; cutoffs.get(i) <= 100 && cutoffs.get(i) >= 0); */ abstract void setCurve(List cutoffs); /** * Ensures the gradebook is sorted according to a rule and that the column is valid */ /*@ requires col <= assignments.size(); ensures (col == 0 && (sortedByName(students) || sortedByRevName(students))) || (col != 0 && (sortedAscending(students, col) || sortedDescending(students, col))); */ abstract Collection sortBy(int col, List students); /** * Return true if the given list is sorted lexicographically by name, according to the semantics * of java.lang.String.compareTo(). */ /*@ ensures (\forall int i ; (i >= 0) && (i < students.size() - 1) ; (students.get(i).firstName).compareTo(students.get(i+1).firstName) < 0); @*/ abstract boolean sortedByName(List students); /** * Return true if the given list is sorted lexicographically by name, according to the semantics * of java.lang.String.compareTo(). */ /*@ ensures (\forall int i ; (i >= 0) && (i < students.size() - 1) ; (students.get(i).firstName).compareTo(students.get(i+1).firstName) > 0); @*/ abstract boolean sortedByRevName(List students); /** * Return true if the given list is sorted in ascending order */ /*@ ensures (\forall int i ; (i >= 0) && (i < students.size() - 1) ; (students.get(i).homework.get(col).points.grade) < (students.get(i+1).homework.get(col).points.grade)); @*/ abstract boolean sortedAscending(List students, int col); /** * Return true if the given list is sorted in ascending order */ /*@ ensures (\forall int i ; (i >= 0) && (i < students.size() - 1) ; (students.get(i).homework.get(col).points.grade) > (students.get(i+1).homework.get(col).points.grade)); @*/ abstract boolean sortedDescending(List students, int col); }