package grade; import java.util.List; import questions.*; import course.*; /** * A QuestionAttempt is a user's attempt at answering a question. A * QuestionAttempt is graded by a grader, and is derived from Section 2.6 in * the requirements. */ public abstract class QuestionAttempt { /** * The test that the question attempt belongs to. */ Test test; /** * The question that is attempted. */ Question question; /** * The maximum possible score that a user can get on the question. */ int maxScore; /** * The score that the grader gives to an attempt. */ int score; /** * The list of comments a grader has on a question attempt. */ List comments; public QuestionAttempt(Question q, Response r, Test t) { } /** * Changes the score of this questionattempt pre: // the new score must be within reaonable limits (newScore >= 0 && newScore <= maxScore); post: // the score must equal the new score (score' == newScore); */ public abstract void editScore(int newScore); /** * Adds a comment to this questionattempt so the student can view it pre: // the comment must not already be in the list of comments (!comments.contains(comment)) post: // the comment must be in the list of comments and the list of comments must be one larger (comments'.contains(comment)) && (comments'.size() == comments.size() + 1); */ public abstract void addComment(String comment); /** * Removes an existing comment from this questionattempt pre: // the comment must already be in the list of comments (comments.contains(comment)) post: // the comment must not be in the list of comments and // the list of comments must be one comment smaller (!comments'.contains(comment)) && (comments'.size() == comments.size()-1); */ public abstract void removeComment(String comment); }