Package com.gophers.structures.grades
Class GradeTemplate
java.lang.Object
com.gophers.structures.grades.GradeTemplate
- All Implemented Interfaces:
Grade
- Direct Known Subclasses:
ChatBotGeneratorGrade,ChatBotGrade,ChatBotPlatformGrade,ChatBotSimulationGrade,ProgramGrade
An abstract class that implements the
Grade interface and provides a
template for grading assignments or tests based on results. This class processes
the outcome of tests, allocates marks based on test weightings, adjusts for failures,
and provides feedback on each test method.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionGradeTemplate(org.junit.runner.Result result, int totalMarks) Constructs a new GradeTemplate instance with the given test result and total available marks. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidAllocates feedback for each test.protected abstract voidAllocates weightings for each test.intgetMarks()Returns the marks earned by the student for the test or assignment.Returns a map containing feedback for each test method.intReturns the total marks available for the assignment or test.
-
Field Details
-
testMarks
A map that stores the marks assigned to each test method. The key is the test method name, and the value is the marks for that test. -
feedbackMap
A map that stores feedback for each test method. The key is the test method name, and the value is the feedback score for that test.
-
-
Constructor Details
-
GradeTemplate
public GradeTemplate(org.junit.runner.Result result, int totalMarks) Constructs a new GradeTemplate instance with the given test result and total available marks. This constructor initializes the weightings and feedback maps, and calculates the marks earned based on the result of the test.- Parameters:
result- The result of running the test, including any failures.totalMarks- The total marks possible for the test or assignment.
-
-
Method Details
-
getMarks
public int getMarks()Returns the marks earned by the student for the test or assignment. This is the total marks available minus any deductions for failed tests. -
getTotalMarks
public int getTotalMarks()Returns the total marks available for the assignment or test.- Specified by:
getTotalMarksin interfaceGrade- Returns:
- The total marks available.
-
getTestFeedback
Returns a map containing feedback for each test method. The map contains test names as keys and feedback scores as values.- Specified by:
getTestFeedbackin interfaceGrade- Returns:
- A map of test names to feedback scores.
-
allocateWeightings
protected abstract void allocateWeightings()Allocates weightings for each test. Subclasses should implement this method to define how marks are distributed across different test methods. -
allocateFeedback
protected abstract void allocateFeedback()Allocates feedback for each test. Subclasses should implement this method to define the feedback for each test method based on the result.
-