package testtool.teacher_app.test_view; /** *The TestGeneration class is derived from the Test Generation document in *Section 2.3 of the requirements. It provides the operation needed for a *test to be generated given parameters the user wants on the test. All of *the data fields in this class are specified in the GUI and determine the *questions the test that is generated will include. */ import java.util.List; import testtool.component.Course; import testtool.component.Test; public abstract class TestGeneration { private String title; private Course course; private int totalPoints; private int time; private int difficulty; private List keywords; private int questionCount; private int[] countTypes; //size = Question.QuestionType.size() /** *generateTest will use the above datafields to generate a test from a *question bank */ /*@ requires (* Data fields are filled in. There is a question bank for the course that is specified. There are enough questions in the question bank to construct the test. It must be possible to create a test with the requested totalPoints, time, and difficulty from the keywords to satisfy the questionCount and countType requirements. *); ensures (* //A test will be generated that has the following properties: //Only contain questions from that course's question database. //Have exactly 100% of the total points specified. test.points.equals(totalPoints); //Have between 80% and 100% of the estimated time specified. test.time >= .8 * time && test.time <= time; //Have +1 / -1 the average difficulty specified. test.difficulty >= difficulty - 1 && test.difficulty <= difficulty + 1; //Only contain questions that contain 100% of the keywords specified. \forall Question tests.questions \forall(keywords) tests.questions.contains(keywords); //Have exactly 100% of the MC questions specified. \forall Question tests.questions \forall countTypes[0] test.questions.has(MULTIPLE_CHOICE); //Have exactly 100% of the FitB questions specified. \forall Question tests.questions \forall countTypes[1] test.questions.has(FILL_IN); //Have exactly 100% of the T/F questions specified. \forall Question tests.questions \forall countTypes[2] test.questions.has(TRUE_FALSE); //Have exactly 100% of the Short Answer questions specified. \forall Question tests.questions \forall countTypes[3] test.questions.has(SHORT_ANSWER); //Have exactly 100% of the Programming questions specified. \forall Question tests.questions \forall countTypes[4] test.questions.has(PROGRAM); //The GUI will also mark the Included checkbox for each question. *); @*/ public abstract Test generateTest(); }