Question: Write a program for course registration. Students can use this program to add and drop courses. There should be a loop in the program that

Write a program for course registration. Students can use this program to add and drop courses. There should be a loop in the program that tells the user to enter A to add course, D to drop course or E to exit. If A is chosen, ask the user to enter the course to add. If the user is already registered in that course, display the message You are already registered in that course; otherwise, add the course to the users course list, display the message Course added, sort the list and display the list. If the user chooses D, ask the user to enter the course to drop. If the user is not registered in that course, display the message You are not registered in that course; otherwise, remove the course from the users course list, display the message Course dropped and display the list. The loop will stop when the user enters E.

The following is an example:

Enter A to add course, D to drop course, and E to exit: A

Enter course to add: CSC151

Course added

Courses registered: ['CSC151']

Enter A to add course, D to drop course, and E to exit: A

Enter course to add: CSC134

Course added

Courses registered: ['CSC134', 'CSC151']

Enter A to add course, D to drop course, and E to exit: A

Enter course to add: CSC139

Course added

Courses registered: ['CSC134', 'CSC139', 'CSC151']

Enter A to add course, D to drop course, and E to exit: D

Enter course to drop: CSC134

Course dropped

Courses registered: ['CSC139', 'CSC151']

Enter A to add course, D to drop course, and E to exit: A

Enter course to add: CSC151

You are already registered in that course

Enter A to add course, D to drop course, and E to exit: A

Enter course to add: CSC121

Course added

Courses registered: ['CSC121', 'CSC139', 'CSC151']

Enter A to add course, D to drop course, and E to exit: E

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!