▶ run configuration · admin session
Admin session
Type admin at the role prompt. Fourteen options manage accounts, courses and reports. Only the two profile updates save immediately; the rest is written on exit.
▶ Student▶ Instructor▶ Administrator
Run as Administrator
Demo login 1122334455 / Default12345
14 options
At a glance# Helpers.showAdminMenu() ---------Administrator Menu---------
1. Add Students.
2. Remove Students.
3. View student list.
4. Add Instructors.
5. Remove Instructors.
6. View instructor list.
7. Add Course.
8. Close Course.
9. Update Student Info.
10. Update Instructor Info.
11. Assign Instructor to Course.
12. View Enrollment Statistics.
13. Generate Reports.
14. Logout.
role admin
login Helpers.login<Administrator>
menu Helpers.showAdminMenu()
option getSafeIntInput("Option: ")
handle switch (choice)
loop until Logout
2 of 14 options write to disk straight away. The rest change the in-memory lists, which are saved when someone types exit.
# Menu text main() calls Persistence 1 Add Students. Helpers .addStudent (loggedInAdministrator, getAllStudents ())on exit 2 Remove Students. Helpers .removeStudent (loggedInAdministrator, getAllStudents ())on exit 3 View student list. loggedInAdministrator.viewStudentList (getAllStudents ())on exit 4 Add Instructors. Helpers .addInstructor (loggedInAdministrator, getAllInstructors ())on exit 5 Remove Instructors. Helpers .removeInstructor (loggedInAdministrator, getAllInstructors ())on exit 6 View instructor list. loggedInAdministrator.viewInstructorList (getAllInstructors ())on exit 7 Add Course. Helpers .addCourse (loggedInAdministrator, getAllCourses (), getAllInstructors ())on exit 8 Close Course. Helpers .closeCourse (loggedInAdministrator, getAllCourses ())on exit 9 Update Student Info. Helpers .adminUpdateStudentProfile (...); saveStudents ()saves students.txt 10 Update Instructor Info. Helpers .adminUpdateInstructorProfile (...); saveInstructors ()saves instructors.txt 11 Assign Instructor to Course. Helpers .assignInstructor (loggedInAdministrator, getAllCourses (), getAllInstructors ())on exit 12 View Enrollment Statistics. dataManagerInstance.viewEnrollmentStatistics ()on exit 13 Generate Reports. dataManagerInstance.generateReports ()on exit 14 Logout. loggedInAdministrator.logout (loggedInAdministrator)on exit
flow + example output
Every option#
input Enter student name: (more than 3 characters) process GenerateRandomID() until the ID is unused input Password, email, phone number, address, each validated input Enter credit limit: process Administrator.addStudent appends it Added Student added: Huda Nasser with the ID: 8301945526
input Enter the ID of the student to remove: process Iterator walks the list and removes the match output Then always prints “Invalid option.” (see Known issues) Removed Noura Saleh with the ID: 2200000002 has been successfully removed Unknown ID 2299999999 is not found.
3 View student list. One line per student.
output toString() of every student Students -ID: 2200000001 Name: Sara Khalid Empty No students are on record.
input Enter instructor name: process Generate a unique random ID input Password, email, phone number, address, each validated Added Instructor added: Reem Aziz with the ID: 5172039486
input Enter the ID of the instructor to remove: process Iterator removes the match Removed Omar Faris with the ID: 4000000002 removed successfully. Unknown ID Instructor with the ID: 4999999999 not found.
6 View instructor list. One line per instructor.
output toString() of every instructor Instructors -ID: 4000000001 Name: Lina Haddad Empty No instructors are on record.
input Enter course name: / Enter course code: input Enter course capacity: / Enter course credit hours: input 1. Assign now. 2. Assign later. input Enter course status: 1. Open 2.Closed process Administrator.addCourse appends it Added Course added: (Operating Systems) (CS330) succesfully. Assigned now Instructor Lina Haddad is assigned to Operating Systems Assign later To be assigned. No instructors No instructors available. Please add an instructor before creating a course.
input Enter course name: / Enter course code: check Full → close it. Already closed → say so. Full Physics I is at full capacity. Already closed Technical Writing enrollment status is closed. Not found Course not found. Open, not full (prints nothing, stays open)
input Student's name: / Student ID: input Yes/No for name, password, email, phone, address input Do you want to change the role? / credit limit? save students.txt is rewritten straight away Updated Student Sara Khalid's profile updated successfully.
input Enter instructor name: / Enter instructor ID: input Yes/No for each field, then the role save instructors.txt is rewritten straight away Updated Instructor Lina Haddad's profile updated successfully.
output ---------Available Courses--------- input Enter the number of the course to assign the instructor to: input Enter the ID of the instructor to assign: check Course has no instructor yet Assigned Instructor Omar Faris is assigned to Physics I Same instructor Instructor Lina Haddad is already assigned to Programming II Taken Course already has a different instructor assigned. Unknown ID Instructor with ID 4999999999 not found.
process Count each course's roster and add them up output One line per course, then two summary lines Report See Reports & statistics for the full output
process Track the course with the most enrolled students Report Most popular course: Programming II (CS102) - Enrolled: 2. No enrolments No enrollments found.
process logout() returns a message, but main() does not print it Back to Enter your role from the current options: (Student/Instructor/Admin) or exit to finish.