a8q5 - CS 116 Assignment 8 Question 5 Ru Wang r46wang...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
## CS 116 Assignment 8 Question 5 ## Ru Wang r46wang 20319247 ## Strings that should be used for displaying output - to assist with autotesting prompt = "Enter operation to be performed: ADSLWC or Q to quit: " id_prompt = "Enter student id: " course_prompt = "Enter course: " add_success = "Added student to course successfully" add_fail = "Course not added: Student already enrolled in 5 courses" drop_success = "Dropped student from course successfully" drop_remove = "Dropped student from course and withdrawn from term" no_courses_msg = "Not enrolled in any courses" withdraw_success = "Withdrawal Successful: student no longer enrolled" uh_oh = "Unrecognized operation" ending = "Registrar's Office closed" ## registrar: dictionary[int[>0]: (listof string)[length[1, 5]] -> none ## purpose: this function consumes a dictionary for the registrar's office with key:value in the form of id: [c1, c2, . ..] ## where id is a positive integer and c1, c2. .. are strings representing courses. This function does not produce anything but may display and mutate the dictionary entered. ## Effects: It asks to input a letter from one of A, D, S, L, W, C, and Q and responds to the following rules: ## If A is entered: ## - it will prompt for student ID and course name ## - If the student id is not found within the dictionary, it will be added to the dictionary ## - If the student is enrolled in less than 5 courses, then the course will be added to the list of courses of the student ## and the message "Added student to course successfully" will be displayed ## - If the student is enrolled in 5 courses, ## then the message "Course not added: Student already enrolled in 5 courses" will be displayed ## If D is entered: ## - It will prompt for student ID and course name ## - If the student was only enrolled in one course previously, ## the student would then be deleted from the dictionary and withdrawn from the term. ## and the message "Dropped student from course and withdrawn from term" would be displayed ## - If the student was enrolled in more than one course, ## the course would be removed from the list of the student's courses ## and the message "Dropped student from course successfully" would be displayed ## If S is entered: ## - It will prompt for student ID ## - If the student is not enrolled in any courses, ## the message "Not enrolled in any courses" is displayed ## - If the student is enrolled in courses, then the list of courses in alphabetical order would be printed ## If L is entered: ## - It will display all students ID within the dictionary in numerical oder
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 6

a8q5 - CS 116 Assignment 8 Question 5 Ru Wang r46wang...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online