CS102/enrolment
Report
enrolment›run configurations›Main.run

run configuration· SchoolCourseEnrolmentSystem.main()

Run the program

The whole application is one loop in main(). Follow it from start-up to exit, or run it right here: the console below replays the report's code against sample data, quirks included.

what main() does, in order

Start-up to exit#

  1. dataManager.getInstance()

    Creates the five empty lists

    Testing Constructor
  2. loadAllData()

    Reads the five files in order: students, instructors, administrators, courses, assessments

    Loading student: …
  3. addAdministrator(DefaultAdmin)

    Registers the built-in admin and saves administrators.txt

    Administrator added: Shoug with ID: 1122334455
  4. Role prompt

    Loops until exit

    Enter your role from the current options: (Student/Instructor/Admin) or exit to finish.
  5. Helpers.login<T>()

    ID, then up to three password attempts

    Please enter your ID:
  6. Role menu loop

    Runs until the user picks Logout

    ---------Student Menu---------
  7. exit

    saveAllData() writes all five files

    Goodbye.

sample data, runs in your browser

Interactive console#

Commands are typed exactly as in the Java program. Try student, then 2200000001 and Student1234. Use the Files tab to compare what is on disk with what is still only in memory.

Role prompt#

Typing anything other than these four words prints Invalid role. Try again. The match ignores case and only reads the first word.

Exit & errors#

Clean exit

Typing exit sets the loop flag, calls saveAllData() to write all five files, prints Goodbye. and lets main() return.

Unexpected error

One try/catch (Exception e) wraps the whole loop. If anything escapes the inner handlers it prints Error: <message> and the program ends without saving.

Every guard and handler is listed on Validation & errors.