▶run configuration· student session
Student session
Type student at the role prompt, log in, and an 8-option menu loops until you log out. Most changes stay in memory until the program exits.
Demo login 2200000001 / Student1234
8 options
At a glance#
Helpers.showStudentMenu()---------Student Menu---------
1. View avaliable courses.
2. Enroll in course.
3. View enrolled courses.
4. View credit limit.
5. Drop course.
6. View grades.
7. Update personal information.
8. Logout.
- role
student
- login
Helpers.login<Student>
- menu
Helpers.showStudentMenu()
- option
getSafeIntInput("Option: ")
- handle
switch (choice)
- loopuntil Logout
1 of 8 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 | View avaliable courses. | loggedInStudent.viewAvailableCourses(getAllCourses()) | on exit |
| 2 | Enroll in course. | Helpers.enroll_In_Course_Student(getAllCourses(), loggedInStudent) | on exit |
| 3 | View enrolled courses. | loggedInStudent.viewEnrolledCourses() | on exit |
| 4 | View credit limit. | loggedInStudent.viewCreditLimit(getAllStudents()) | on exit |
| 5 | Drop course. | Helpers.dropCourse(getAllCourses(), loggedInStudent) | on exit |
| 6 | View grades. | loggedInStudent.viewGrades(getAllAssessments()) | on exit |
| 7 | Update personal information. | Helpers.updateStudentProfile(loggedInStudent); saveStudents() | saves students.txt |
| 8 | Logout. | loggedInStudent.logout(loggedInStudent) | on exit |
flow + example output
Every option#
- outputAvailable courses are:
- processLoop over every course
- checkNot full and status is Open
- outputName, code, schedule, instructor and capacity
- A course qualifies
- (Course name: Programming II) (Course code: CS102) (Course schedule: Sun/Tue 10:00) (Course instructor: -ID: 4000000001 Name: Lina Haddad) (Course capacity: 30).
- Nothing qualifies
No courses are avaliable.
- processFilter: not full, Open, not already enrolled
- outputNumbered list of those courses
- inputEnter the number of the course you would like to enroll in:
- checkAlready enrolled? Full? Closed? Over the credit limit?
- processAdd course to student and student to course
- Enrolled
Sara Khalid enrolled successfully
- Already enrolled
You are already enrolled in (Programming II) (CS102).
- Course is full
Cannot enroll in Physics I - course is full.
- Course is closed
Enrollment status is closed.
- Too many hours
Cannot enroll in Data Structures - credit limit exceeded.
- Nothing to join
No available courses to enroll in.
- Bad number
Invalid selection: 9
- checkAny enrolled courses?
- outputName, code, credit hours and schedule for each
- Has courses
1- (Programming II) (CS102) (3). The schedule is: Sun/Tue 10:00.
- No courses
Sara Khalid is not enrolled in any courses.
- processTake the first student in the list (see Known issues)
- outputCredit limit, then limit minus enrolled hours
- Always
Your credit limit is: 15
Remaining credit limit is: 12 hours.
- inputEnter course code of the course you would like to drop:
- checkCode exists (case-insensitive)
- checkYou are enrolled, and the course is Open
- processRemove the course from your list
- Dropped
Sara Khalid has successfully dropped (Programming II) (CS102).
- Not enrolled
Sara Khalid is not enrolled in (Technical Writing) (ENG101).
- Course closed
Drop period is closed.
- Unknown code
No course found with the codeXYZ1'.
- output1. View a specific exam score. 2. View all grades in a course. 3. View total average in a course.
- inputOption, then a course number (and an exam type for option 1)
- processFilter grades by your ID and the course code
- One score
Your Quiz_1 score: 88.0
- All grades
Quiz_1: 88.0
Midterm_1: 91.5
- Average
Your total average grade in CS102 is: 89.75
- No grades
No grades found for this course.
- No courses
You are not enrolled in any courses.
- inputDo you want to change your password? 1.Yes 2.No
- checkEach new value must pass its validator
- inputSame for email, phone number and address
- savestudents.txt is rewritten straight away
- Saved
Student Sara Khalid's information updated.
- Rejected value
Invalid email. Please try again.
- Kept value
password remains unchanged.
- processlogout() 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.