CS102/enrolment
Report
enrolment›docs›KNOWN_ISSUES.md

KNOWN_ISSUES.md

Known issues

Behaviours worth knowing before you read or run the code. Some come from the report itself; the rest were found by reading the report's listings line by line. The console on this site reproduces them.

bug

View credit limit shows the first student, not you

seen in the listing

The method loops over the whole student list and breaks after the first iteration, so it always prints the first student's limit and remaining hours.

FixUse this.getCreditLimit() and this.enrolledInHours() instead of looping.

bug

Dropping a course does not free the seat

seen in the listing

dropCourse removes the course from the student's list but never removes the student from the course's enrolledStudents. The roster, isFull() and the statistics still count the student.

FixAlso call course.getEnrolledStudents().remove(this).

bug

Saved enrolments are lost when students load

seen in the listing

loadStudents runs before loadCourses, so getCourseByCode finds nothing and every student starts with no enrolled courses. Course rosters still list them, and enrolling again adds a duplicate roster entry.

FixLoad courses first, then resolve student course codes in a second pass.

design

Most changes are only written on exit

seen in the listing

Enrolments, drops, grades, new or removed accounts, new or closed courses and instructor assignments stay in memory until someone types exit. Closing the window or an unexpected error loses them.

FixUse the dataManager methods that already save (enrollStudentInCourse, closeCourse…) or save after each change.

bug

An open course with space cannot be closed

seen in the listing

Administrator.closeCourse only closes full courses. For an open course that still has space, the “still has available capacity” branch can never be reached, so nothing is printed and the course stays open.

FixAdd an else branch that sets the status to Closed.

bug

Unknown instructor ID aborts course creation

seen in the listing

If the ID does not match anyone, assignInstructor is called with null and calls getName() on it. The NullPointerException is caught, the message (null in Java 8) is printed, and the course is never added.

FixCheck selectedInstructor before calling assignInstructor.

quirk

Removing a student always ends with “Invalid option.”

seen in the listing

The println sits after the try/catch instead of inside the catch, so it runs every time.

FixMove it into the catch block.

quirk

Logout messages are never shown

seen in the listing

Each logout() returns a string such as “Student Sara Khalid logged out.”, but main() ignores the return value.

FixPrint the returned message.

quirk

Admin login prints “No admin record” inside the loop

from the report

The failure message prints once for every administrator checked before the match, so a successful login can still show it.

FixPrint it once, after the loop.

design

Instructor constructor ignores enrolledStudents

from the report

The constructor takes a List<Student> but never uses it. This may be intentional or an oversight.

FixRemove the parameter.

design

User setters do not validate

from the report

Input is checked by the Helpers validators before setters are called, which keeps User small but means code that calls a setter directly can store anything.

quirk

Helpers.viewEnrollmentStatistics would throw

seen in the listing

Its printf has three placeholders but two arguments, which throws MissingFormatArgumentException. main() calls the dataManager version instead, so it never runs.

FixPass the course code, or delete the unused copy.

quirk

Instructor profile update prints its message twice

seen in the listing

Both Instructor.updateInstructorPersonalInfo and the helper print “Instructor <name>'s information updated.”

design

gradeStudent opens its own Scanner

seen in the listing

It creates new Scanner(System.in) for the score, while the rest of the program shares Helpers.input. Two Scanners on one stream can swallow buffered input.

FixUse Helpers.input or Helpers.getSafeIntInput.

from the report

Improvement ideas#

  • Consolidate repetitive console input and output logic.
  • Validate phone numbers with a regular expression (digits only, not just 10 characters).
  • Avoid printing “not found” messages repeatedly inside loops.
  • Separate input and output from business logic so the classes can be tested.