CS102/enrolment
Report
enrolment›docs›ARCHITECTURE.md

ARCHITECTURE.md

Architecture

Nine classes in one package, in three layers: entities that model the university, support classes for input and storage, and a main class that runs the loop.

Layers#

EntitiesModel the people, courses and grades.
SupportInput, validation, menus and file storage.
ApplicationThe loop that ties it together.

Class map#

Class index#

ClassKindResponsibilityLines
Userabstract classAbstract generic base for every account type.91source
StudentclassEnrols, drops, checks credit hours and views grades.209source
InstructorclassViews rosters, grades students and edits course details.210source
AdministratorclassManages accounts, courses and instructor assignments.192source
CourseclassA course: capacity, credit hours, status and roster.183source
AssessmentclassOne grade: student × course × exam type → score.190source
Helpersutility classShared input, validation, login, menus and multi-step flows.806source
dataManagersingleton classSingleton storage layer: five lists, five text files.696source
SchoolCourseEnrolmentSystemmain classEntry point: load, register the default admin, loop, save.195source

Listings come from the project report and were re-indented when extracted from the PDF, so wrapping may differ slightly from the original files.

Design decisions#

When data is saved#

Only a few actions write to disk immediately. Everything else waits for saveAllData() at exit, which is why closing the window loses work (see Known issues).

WhoActionFileWritten
Start-upRegister the default adminadministrators.txtimmediately
Student7 · Update personal informationstudents.txtimmediately
Instructor3 · Update course informationcourses.txtimmediately
Instructor4 · Update personal informationinstructors.txtimmediately
Admin9 · Update Student Infostudents.txtimmediately
Admin10 · Update Instructor Infoinstructors.txtimmediately
Student2 · Enroll / 5 · Dropstudents.txton exit only
Instructor2 · Grade assignmentsassessments.txton exit only
Admin1, 2 · Add / remove studentsstudents.txton exit only
Admin4, 5 · Add / remove instructorsinstructors.txton exit only
Admin7, 8, 11 · Add / close course, assign instructorcourses.txton exit only
ExitType exit at the role promptall five filesimmediately

Project layout#

treeSchoolCourseEnrolmentSystem/
├─ src/schoolcourseenrolmentsystem/
│  ├─ User.java  Student.java  Instructor.java  Administrator.java
│  ├─ Course.java  Assessment.java
│  ├─ Helpers.java  dataManager.java
│  └─ SchoolCourseEnrolmentSystem.java   ← main()
├─ students.txt  instructors.txt  administrators.txt
├─ courses.txt  assessments.txt         ← written next to the program
└─ web/                                 ← this website