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#
dataManager.getInstance()Creates the five empty lists
Testing Constructor
loadAllData()Reads the five files in order: students, instructors, administrators, courses, assessments
Loading student: …
addAdministrator(DefaultAdmin)Registers the built-in admin and saves administrators.txt
Administrator added: Shoug with ID: 1122334455
Role promptLoops until exit
Enter your role from the current options: (Student/Instructor/Admin) or exit to finish.
Helpers.login<T>()ID, then up to three password attempts
Please enter your ID:
Role menu loopRuns until the user picks Logout
---------Student Menu---------
exitsaveAllData() 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.