package Prediction; import Visual.*; import Grades.*; import Info.*; import Reports.*; import Assignments.*; import java.util.Collection; import java.util.List; /* * A prediction object uses the class assignments, expected scores typed in by the user and the grading * scheme used by the teacher in order to accurately predict grading scenarios for students. * * This object is derived from Section 2.7 of the requirements. */ public abstract class Prediction { /** Stores the desired final grade typed in by the user. */ long desiredGrade; /** Stores the predicted final grade after calculations. */ long finalGrade; /** A complete collection of assignments scheduled for the class. */ List classAssignments; /* * This method calculates the final grade in a course based on the expected scores for all assignments. * */ /*@ requires // The scores for all upcoming assignments have been typed in. (\forall Assignment classAssignment; expectedAssignments.contains(classAssignment)); ensures // The result of the function will equal the added weighted grade of all expected scores // typed in by the user. (\result == (\sum int i; (i >= 0) && (i < expectedAssignments.size()) ; expectedAssignments.get(i).points.grade * expectedAssignments.get(i).points.weight)); @*/ abstract long calculateFinalGrade(List expectedAssignments); /* * This method calculates the scores needed on assignments in order to obtain the desired final grade. */ /*@ requires // The desired grade typed in by the user is non-negative. (desiredGrade >= 0); ensures // The sum of the returning list of grades is equal to the desired grade typed in by the user. (desiredGrade == (\sum int i; (i >= 0) && (i < \result.size()) ; \result.get(i).grade * \result.get(i).weight)); @*/ abstract List calculateScores(); /* * This method calculates the maximum grade a student could obtain in a class. */ /*@ ensures // The result of the function will equal the sum of the maximum scores of all class assignments. (\result == (\sum int i; (i >= 0) && (i < classAssignments.size()) ; classAssignments.get(i).points.maxPoints * classAssignments.get(i).points.weight)); @*/ abstract long getMaxGrade(); }