Storyboard StudyRightWithAssignmentsStoryboard

1. (start situation/pre-condition) Karli enters the Study-Right University in the math room. Karli has no credits yet and still a motivation of 214.

      University university = new University()
         .withName("StudyRight");

      Student karli = university.createStudents()
         .withId("4242")
         .withName("Karli");

      Assignment matrixMult = new Assignment()
         .withContent("Matrix Multiplication")
         .withPoints(5);

      Assignment series = new Assignment()
         .withContent("Series")
         .withPoints(6);

      Assignment a3 = new Assignment()
         .withContent("Integrals")
         .withPoints(8);

      Room mathRoom = university.createRooms()
         .withName("senate")
         .withTopic("math")
         .withCredits(17)
         .withStudents(karli)
         .withAssignments(matrixMult, series, a3);

      Room artsRoom = university.createRooms()
         .withName("7522")
         .withTopic("arts")
         .withCredits(16)
         .withDoors(mathRoom);

      Room sportsRoom = university.createRooms()
         .withName("gymnasium")
         .withTopic("sports")
         .withCredits(25)
         .withDoors(mathRoom, artsRoom);

      Room examRoom = university.createRooms()
         .withName("The End")
         .withTopic("exam")
         .withCredits(0)
         .withDoors(sportsRoom, artsRoom);

      Room softwareEngineering = university.createRooms()
         .withName("7422")
         .withTopic("Software Engineering")
         .withCredits(42)
         .withDoors(artsRoom, examRoom);

2. Karli does assignment a1 on Matrix Multiplication and earns 5 points
(general rule: the student earns always full points for doing an assignment).
Karli's motivation is reduced by 5 points to now 209.

      karli.setAssignmentPoints(karli.getAssignmentPoints() + matrixMult.getPoints());
      karli.withDone(matrixMult);

3. Karli does assignment a2 on Series and earns another 6 points.
Thus Karli has 11 points now. Motivation is reduced to 203.

      karli.setAssignmentPoints(karli.getAssignmentPoints() + series.getPoints());
      karli.withDone(series);

4. Karli does the third assignment on Integrals, earns
another 8 points and thus Karli has now 19 points and a motivation of 195.

      karli.setAssignmentPoints(karli.getAssignmentPoints() + a3.getPoints());
      karli.withDone(a3);

5. Since 19 points are more than the 17 points required for the 17 math credits, Karli hands the points in and earns the credits and has his assignmnet points reset to 0.
(General rule: if the points earned by the assignments are higher or equal than the credit points, the credit points will be awarded to the student.)

      if (karli.getAssignmentPoints() >= mathRoom.getCredits())
      {
         karli.setCredits(karli.getCredits() + mathRoom.getCredits());
         karli.setAssignmentPoints(0);
      }

6. (end situation/post-condition) Karli has completed the math topic and moves to sports.

Check: Karli's credits: 17 actual 17

Check: Karli's assignment points: 0 actual 0

Check: Number of students: 1 actual 1