CSC 217 Lab 09 - Stacks and Queues

CSC 217 Lab 09 - Requirements

CSC 217 Lab 09 Requirements

PackScheduler is a course registration system for a university, similar to the system in MyPackPortal that you use to register for your classes. You’ll work on implementing a system that provides the functionality for admitted students to register for courses that are taught by faculty. The courses will have enrollment caps and waitlists.

For Lab 09, you will add a waitlist to the course roll, which is described in

[UC8], [UC10], [UC14], and [UC15].


Users

Requirements

Data Formats


Users

There are several types of users for the PackScheduler system. The users listed here are the people that would interact with the system. They may or may not correspond to classes in the system. The user roles are summarized below.

Registrar

The registrar is a university official that maintains the directory of enrolled students.

Student

The student is registered in the system by the registrar and can create a schedule of courses from courses listed in the course catalog that do not conflict with each other.

Requirements

Use Case 0: Start PackScheduler

Starts the PackScheduler application.

Main Flow

  1. The user starts the Pack Scheduler application.
  2. The user enters their id and password in the authentication area and clicks the OK button [Hash Password] [Already Logged In] [Invalid Authentication].
  3. The user is redirected to the appropriate functionality for the user type of [Registrar] or [Student].

Extensions (Sub-flows)

Alternative Flows

  • [Already Logged In] If a user is already logged into the system, a new user may not log in.
  • [Invalid Authentication] If the user doesn’t exist in the system or the user’s hashed password doesn’t match the stored hashed password, a pop-up message stating “Invalid id or password” is displayed. The user clicks OK and is returned to the authentication window.

Use Case 1: Stop PackScheduler

Stops the PackScheduler application.

Preconditions

The user is in the main window of the PackScheduler application.

Main Flow

  1. The user clicks the close window button.
  2. The application closes without any errors.

Use Case 2: Create Student Directory

The registrar can create a new, empty, student directory.

Preconditions

The PackScheduler application has started and the registrar has selected to work with Student Directories.

Main Flow

  1. The registrar clicks the New Student Directory button.
  2. A new empty Student Directory is created.
  3. The display is updated so that the Student Directory list is empty.

Use Case 3: Load Student Directory

The registrar can load a student directory from a file.

Preconditions

The PackScheduler application has started and the registrar has selected to work with Student Directories.

Main Flow

  1. The registrar clicks the Load Student Directory button.
  2. A dialog appears and the user can browse the file system for the text file containing student information [Student Records Data Format] [Invalid File].
  3. A list of students is created from valid records. Invalid records are ignored [Invalid Student Records].
  4. All students are stored in the directory in alphabetical order by last name and then by first name. If there are two students with the same name, then the id is considered in the sort.

Alternative Flows

  • [Invalid File] If the file cannot be found on the file system, the error message “Unable to read file X” is displayed, where ‘X’ is the filename. The user clicks OK and is returned to the student directory display.

Use Case 4: Save Student Directory

The registrar can save the current list of students in a student directory to a file.

Preconditions

The PackScheduler application has started and the registrar has selected to work with Student Directories.

Main Flow

  1. The registrar clicks the Save Student Directory button.
  2. A dialog appears and the user selects the location to save the list of students and provides a name for the file [Error Saving].
  3. The list of students is saved to a text file with a student record on each line [Student Records Data Format]. The students are saved in sorted order by last name, first name, and id.

Alternative Flows

  • [Error Saving] If the file cannot be saved, the error message “Unable to write to file X” is displayed, where ‘X’ is the filename. The user clicks OK and is returned to the student directory display.

Use Case 5: Add Student to Student Directory

The registrar can add a student to the student directory.

Preconditions

The PackScheduler application has started and the registrar has selected to work with Student Directories.

Main Flow

  1. The registrar enters information about a new student in the Student Information portion of the user interface [Student Records Data Format] and clicks Add Student button.
  2. The password and repeated password are hashed using SHA-256 and must match [Non-matching Passwords].
  3. The student is added to the Student Directory in sorted order by last name, first name, and id [Non-unique ID].

Alternative Flows

  • [Invalid First Name] If the student’s first name is invalid [Invalid Student Records], the error message “Invalid first name” is displayed. The user clicks OK and is returned to the student directory display.
  • [Invalid Last Name] If the student’s last name is invalid [Invalid Student Records], the error message “Invalid last name” is displayed. The user clicks OK and is returned to the student directory display.
  • [Invalid ID] If the student’s id is invalid [Invalid Student Records], the error message “Invalid id” is displayed. The user clicks OK and is returned to the student directory display.
  • [Invalid Email] If the student’s email is invalid [Invalid Student Records], the error message “Invalid email” is displayed. The user clicks OK and is returned to the student directory display.
  • [Invalid Password] If the student’s password or repeated password is invalid [Invalid Student Records], the error message “Invalid password” is displayed. The user clicks OK and is returned to the student directory display.
  • [Non-matching Passwords] If the student’s password and repeated passwords do not match, the error message “Passwords do not match” is displayed. The user clicks OK and is returned to the student directory display.
  • [Non-unique ID] If the student’s id is not unique, the error message “Student already in system.” is displayed. The user clicks OK and is returned to the student directory display.

Use Case 6: Remove Student from Student Directory

The registrar can remove a student from the student directory.

Preconditions

The PackScheduler application has started and the registrar has selected to work with Student Directories.

Main Flow

  1. The registrar selects a student in the Student Directory list and clicks the Remove Student button [No Student Selected].
  2. The student is removed from the Student Directory list.

Alternative Flows

  • [No Student Selected] If there is no student selected, the error message “No student selected.” is displayed. The user clicks OK and is returned to the student directory display.

Use Case 7: Create Course Catalog

The registrar can create a new, empty, course catalog.

Preconditions

The PackScheduler application has started and the registrar has selected to work with the Course Catalog.

Main Flow

  1. The registrar clicks the New Course Catalog button.
  2. Any courses in the catalog are cleared.
  3. A new empty Course Catalog is created.
  4. The display is updated so that the Course Catalog list is empty.

Use Case 8: Load Course Catalog

The registrar can load a course catalog from a file.

Preconditions

The PackScheduler application has started and the registrar has selected to work with the Course Catalog.

Main Flow

  1. The registrar clicks the Load Course Catalog button.
  2. A dialog appears and the user can browse the file system for the text file containing course information [Course Records Data Format] [Invalid File].
  3. A list of courses is created from valid records. Invalid records are ignored [Invalid Course Records].
  4. All courses are stored in the catalog in alphabetical order by course name and section.
  5. All courses have a waitlist of size 10.

Alternative Flows

  • [Invalid File] If the file cannot be found on the file system, the error message “Unable to read file X” is displayed, where ‘X’ is the filename. The user clicks OK and is returned to the course catalog display.

Use Case 9: Save Course Catalog

The registrar can save the current list of courses in the course catalog to a file.

Preconditions

The PackScheduler application has started and the registrar has selected to work with the Course Catalog.

Main Flow

  1. The registrar clicks the Save Course Catalog button.
  2. A dialog appears and the user selects the location to save the list of courses and provides a name for the file [Error Saving].
  3. The list of courses is saved to a text file with a course record on each line [Course Records Data Format]. The courses are saved in sorted order by course name and section.

Alternative Flows

  • [Error Saving] If the file cannot be saved, the error message “Unable to write to file X” is displayed, where ‘X’ is the filename. The user clicks OK and is returned to the course catalog display.

Use Case 10: Add Course to Course Catalog

The registrar can add a course to the course catalog.

Preconditions

The PackScheduler application has started and the registrar has selected to work with the Course Catalog.

Main Flow

  1. The registrar enters information about a new course in the Course Information portion of the user interface [Course Records Data Format] and clicks Add Course button.
  2. The course is added to the Course Catalog in sorted order by course name and section [Duplicate Course].
  3. All courses have a waitlist of size 10.

Alternative Flows

  • [Invalid Name] If the course’s name is invalid [Invalid Course Records], the error message “Invalid course name” is displayed. The user clicks OK and is returned to the course catalog display.
  • [Invalid Title]: If the course’s title is invalid [Invalid Course Records], the error message “Invalid course title” is displayed. The user clicks OK and is returned to the course catalog display.
  • [Invalid Section]: If the course’s section number is invalid [Invalid Course Records], the error message “Invalid section number” is displayed. The user clicks OK and is returned to the course catalog display.
  • [Invalid Credit Hours]: If the course’s credit hours is invalid [Invalid Course Records], the error message “Invalid credit hours” is displayed. The user clicks OK and is returned to the course catalog display.
  • [Invalid Instructor ID]: If the course’s instructor unity id is invalid [Invalid Course Records], the error message “Invalid instructor unity id” is displayed. The user clicks OK and is returned to the course catalog display.
  • [Invalid Instructor ID]: If the course’s enrollment capacity is invalid [Invalid Course Records], the error message “Invalid instructor unity id” is displayed. The user clicks OK and is returned to the course catalog display.
  • [Invalid Meeting Days]: If the course’s meeting days are invalid [Invalid Course Records], the error message “Invalid meeting days” is displayed. The user clicks OK and is returned to the course catalog display.
  • [Invalid Time]: If the course’s start time is invalid, end time is invalid [Invalid Course Records], or the start time and end time together are invalid, the error message “Invalid X” is displayed, where X is start time, end time, or course times. The user clicks OK and is returned to the course catalog display.
  • [Duplicate Course] If the course’s name and section already exist in the catalog, the error message “Course already in system.” is displayed. The user clicks OK and is returned to the course catalog display.

Use Case 11: Remove Course from Course Catalog

The registrar can remove a course from the course catalog.

Preconditions

The PackScheduler application has started and the registrar has selected to work with the Course Catalog.

Main Flow

  1. The registrar selects a course in the Course Catalog list and clicks the Remove Course button [No Course Selected].
  2. The course is removed from the Course Catalog list.

Alternative Flows

  • [No Course Selected] If there is no course selected, the error message “No course selected.” is displayed. The user clicks OK and is returned to the course catalog display.

Use Case 12: Rename Schedule

The student changes the schedule’s title from the default name of “My Schedule”. The student can provide a new title for their schedule or leave the title empty.

Preconditions

The PackScheduler application has started, at least one course has been loaded into the course catalog, and the currently logged in user is a Student.

Main Flow

  1. The student replaces the current schedule title with a new name
  2. The student saves the new schedule title
  3. The system sets the title of the schedule to the submitted text [Invalid Title]

Alternative Flows

  • [Invalid Title]: The system displays a message stating “Invalid title.”. The student clicks OK and is returned to the main user interface with no change.

Use Case 13: View Course Information

The student selects a course from the catalog to see all the information about the course.

Preconditions

The PackScheduler application has started, at least one course has been loaded into the course catalog, and the currently logged in user is a Student.

Main Flow

  1. The student selects a course in the catalog.
  2. The course details are displayed with the course name, section, title, instructor, credit hours, and meeting information. If the meeting days are “A”, the details view shows “Arranged”. Otherwise, the meeting information shows the meeting days followed by the start time in standard time (e.g., 1:30PM), a dash, and the end time in standard time. Only “AM” and “PM” are used.

Use Case 14: Add Course to Schedule

The student adds a course from the course catalog into their schedule.

Preconditions

The PackScheduler application has started, at least one course has been loaded into the course catalog, and the currently logged in user is a Student.

Main Flow

  1. The student selects the desired course to add from the course catalog.
  2. The student clicks the add course button.
  3. The system updates the schedule to include the selected course [Already Added] [Schedule Conflict]
  4. The student is added to the course’s roll. [Already Enrolled]
  5. If the course is at max enrollment and there’s room on the waitlist, the student is added to the end of the waitlist [Course Full]

Alternative Flows

  • [Already Added]: If the student has already added a course with the same name to their schedule (the same section or a different section), a pop-up message stating “You are already enrolled in .” is displayed, where is replaced with the name of the course. The student clicks OK and is returned to their schedule with no change.
  • [Schedule Conflict]: If the course conflicts with another course or event (meaning there is an overlap of at least one day and time, even by the same minute) on the student’s schedule, a pop-up message stating “The course cannot be added due to a conflict.” is displayed. The student clicks OK and is returned to their schedule with no change.
  • [Already Enrolled]: If the student is already enrolled in the course (i.e., on the course roll), a pop-up message stating “Course cannot be added to schedule.” is displayed. The student clicks OK and is returned to their schedule with no change.
  • [Course Full]: If the course is full (meaning the course has reached capacity and the waitlist has no more spots), a pop-up message stating “The course cannot be added” is displayed. The student clicks OK and is returned to their schedule with no change.

Use Case 15: Remove Course from Schedule

The student removes a course from their current schedule.

Preconditions

The PackScheduler application has started, at least one course has been loaded into the course catalog, and the currently logged in user is a Student.

Main Flow

  1. The student selects the desired course to remove from their schedule.
  2. The student clicks the remove course button.
  3. The system updates the schedule to remove the selected course [No Selected Course]
  4. The student is removed from the course’s roll.
  5. If there is a student on the waitlist, the student who joined the waitlist first is removed from the waitlist and is enrolled in the course

    [UC14].

Alternative Flows

  • [No Selected Course]: If no course is selected in the student’s schedule, a pop-up message stating “No item selected in the schedule.” is displayed. The student clicks OK and is returned to their schedule with no change.

Use Case 16: Reset Schedule

The student clears their schedule and resets it to its defaults.

Preconditions

The PackScheduler application has started, at least one course has been loaded into the course catalog, and the currently logged in user is a Student.

Main Flow

  1. The student clicks the reset schedule button.
  2. The system removes all events and courses from the schedule and changes the title of the schedule to the default “My Schedule”

Use Case 17: Display Final Schedule

The student displays their final schedule with all information about the scheduled activities.

Preconditions

The PackScheduler application has started, at least one course has been loaded into the course catalog, and the currently logged in user is a Student.

Main Flow

  1. The student clicks the display schedule button.
  2. The student sees the list of scheduled courses and events with columns for name, section, title, instructor, credit hours, meeting information, weekly repeat, and description. If the meeting days are “A”, the details view shows “Arranged”. Otherwise, the meeting information shows the meeting days followed by the start time in standard time (e.g., 1:30PM), a dash, and the end time in standard time. Only “AM” and “PM” are used. If the row is an event, then the name, section, instructor, and credit hours are left blank.
  3. The student clicks the revise schedule button to return to the schedule editing functionality.

Data Format

Student Records

Student records can be saved and loaded from a file in the correct format. An example of a valid file would be:

Zahir,King,zking,orci.Donec@ametmassaQuisque.com,0ÉRú±"ÃùuŸ¦Ù\7X²F´þâ9•{-OîFâapÄ,15
Cassandra,Schwartz,cschwartz,semper@imperdietornare.co.uk,0ÉRú±"ÃùuŸ¦Ù\7X²F´þâ9•{-OîFâapÄ,4
Shannon,Hansen,shansen,convallis.est.vitae@arcu.ca,0ÉRú±"ÃùuŸ¦Ù\7X²F´þâ9•{-OîFâapÄ,14
Demetrius,Austin,daustin,Curabitur.egestas.nunc@placeratorcilacus.co.uk,0ÉRú±"ÃùuŸ¦Ù\7X²F´þâ9•{-OîFâapÄ,18
Raymond,Brennan,rbrennan,litora.torquent@pellentesquemassalobortis.ca,0ÉRú±"ÃùuŸ¦Ù\7X²F´þâ9•{-OîFâapÄ,12
Emerald,Frost,efrost,adipiscing@acipsumPhasellus.edu,0ÉRú±"ÃùuŸ¦Ù\7X²F´þâ9•{-OîFâapÄ,3
Lane,Berg,lberg,sociis@non.org,0ÉRú±"ÃùuŸ¦Ù\7X²F´þâ9•{-OîFâapÄ,14
Griffith,Stone,gstone,porta@magnamalesuadavel.net,0ÉRú±"ÃùuŸ¦Ù\7X²F´þâ9•{-OîFâapÄ,17
Althea,Hicks,ahicks,Phasellus.dapibus@luctusfelis.com,0ÉRú±"ÃùuŸ¦Ù\7X²F´þâ9•{-OîFâapÄ,11
Dylan,Nolan,dnolan,placerat.Cras.dictum@dictum.net,0ÉRú±"ÃùuŸ¦Ù\7X²F´þâ9•{-OîFâapÄ,5

A student has a first name, last name, id, email address, password, and max number of credits they can take in a given semester. To protect the student’s information, the student’s password should be hashed using SHA-256 when stored. Note that the hashed values may look different depending on what application you are using to view the input file.

When stored in a text file, a student record is a comma separated list in the following format:

firstName,lastName,id,email,hashedPassword,maxCredits

Invalid Student Records

A student record is invalid in at least the following situations:

  • an item is missing
  • first name is null or an empty string
  • last name is null or an empty string
  • id is null or an empty string
  • email is null or an empty string
  • email doesn’t contain an ‘@’ character
  • email doesn’t contain a ‘.’ character
  • the index of the last ‘.’ character in the email string is earlier than the index of the first ‘@’ character (e.g., first.last@address would be invalid)
  • the password is null or an empty string
  • max credits is below 3 or above 18

Course Records

Course records can be saved and loaded from a file in the correct format. An example of a valid file would be:

CSC116,Intro to Programming - Java,001,3,jdyoung2,10,MW,0910,1100
CSC116,Intro to Programming - Java,002,3,spbalik,10,MW,1120,1310
CSC116,Intro to Programming - Java,003,3,tbdimitr,10,TH,1120,1310
CSC116,Intro to Programming - Java,002,3,jtking,10,TH,0910,1100
CSC216,Software Development Fundamentals,001,3,sesmith5,10,TH,1330,1445
CSC216,Software Development Fundamentals,002,3,ixdoming,10,MW,1330,1445
CSC216,Software Development Fundamentals,601,3,jctetter,10,A
CSC217,Software Development Fundamentals Lab,202,1,sesmith5,10,M,1040,1230
CSC217,Software Development Fundamentals Lab,211,1,sesmith5,10,T,830,1020
CSC217,Software Development Fundamentals Lab,223,1,sesmith5,10,W,1500,1650
CSC217,Software Development Fundamentals Lab,601,1,sesmith5,10,A
CSC226,Discrete Mathematics for Computer Scientists,001,3,tmbarnes,10,MWF,935,1025
CSC230,C and Software Tools,001,3,dbsturgi,10,MW,1145,1300
CSC316,Data Structures and Algorithms,001,3,jtking,10,MW,830,945

A course has a course name, course title, section number, number of credit hours, instructor’s unity id, enrollment capacity, meeting days, start time, and end time. When stored in a text file, a course record is a comma separated list in the following format:

courseName,courseTitle,sectionNumber,creditHours,instructorUnityID,enrollmentCap,meetingDays,startTime,endTime
// Note that enrollmentCap is a NEW item in the list

Invalid Course Records

A course record is invalid in at least the following situations:

  • an item is missing
  • the course name is null or an empty string
  • the course name doesn’t meet the format of beginning with 1-4 letters, followed by exactly 3 digits, followed by an optional 1 letter suffix
  • the course name is fewer than 4 characters or greater than 8 characters
  • the course title is null or an empty string
  • the section number is NOT exactly three digits
  • the credit hours are not a number
  • the credit hours are less than 1 or greater than 5
  • the instructor’s id is null or an empty string
  • the enrollment capacity is less than 10 or greater than 250
  • meeting days consist of any characters other than ‘M’, ‘T’, ‘W’, ‘H’, ‘F’, or ‘A’
  • meeting days have a duplicate character
  • if ‘A’ is in the meeting days list, it must be the only character
  • the start time is not between 0000 and 2359 an invalid military time
  • the end time is not between 0000 and 2359 or an invalid military time
  • the end time is less than the start time (i.e., no overnight classes)
  • a start time and/or end time is listed when meeting days is ‘A’
  • a course with the same name and section