Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Module: registration.py You must define the following functions in the main module. Function Specification login(id, s_list) This function allows a student to log in.It has

Module: registration.py

You must define the following functions in the main module.

Function

Specification

login(id, s_list)

This function allows a student to log in.It has two parameters:

id is the ID of the student

s_list, which is the student list

This function asks user to enter PIN. If the ID and PIN combination is in s_list, display message of verification and return True.Otherwise, display error message and return False.

main()

This function manages the whole registration system.It has no parameter.It creates 4 lists to store data: student list, course list, maximum class size list and roster list.It uses a loop to serve multiple students.Inside the loop, ask user to enter ID, and call the login function to verify student's identity.If login is successful, use a loop to allow a student to choose to add courses, drop courses or list courses the student has registered for or if they want to display a bill. This function has no return value.

This program uses a few lists to store data. To make grading easier, data will be added to these lists at the beginning of the main function.

student_list = [('1001', '111'), ('1002', '222'), ('1003', '333'), ('1004', '444')]

in_state_list = ['1001', '1003']

course_list = ['CSC101', 'CSC102', 'CSC103', 'CSC104']

course_hours = [3, 4, 5, 3]

max_size_list = [3, 2, 1, 3]

roster_list = [['1004', '1003'], ['1001'], ['1002'], []]

There are 4 students in this program.ID and PIN of students are stored as tuples in student_list.The first element of each tuple is student ID and the second element is the PIN.

Students that are in-state are stored in the in_state_list. Students 1001 and 1003 are in-state students.

Four courses are offered.The course codes are stored in course_list.These courses are CSC101, CSC102, CSC103, and CSC104.

Each course has a number of credit hours. The credit hour information is stored in course_hours. CSC101 has 3 credit hours. CSC102 has 4 credit hours. CSC103 has 5 credit hours. CSC104 has 3 credit hours.

The maximum class size of the courses offered are stored in max_size_list.The max sizes of CSC101, CSC102, CSC103, and CSC104 are 3, 2, 1, and 3 respectively.

Rosters of the four classes offered are stored as four lists, which are four elements of roster_list, which is actually a list of lists.Students 1004 and 1003 are enrolled in CSC101.Student 1001 is enrolled in CSC102.Student 1002 is enrolled in CSC103. No one is enrolled in CSC104.

The program should have a loop to create multiple student sessions.In each session, ask user to enter ID, then call the login function to verify the student's identity.If login is successful, use a loop to allow the student to add courses, drop courses, list courses registered, or display a bill.

The following is an example.

Enter ID to log in, or 0 to quit: 1234

Enter PIN: 123

ID or PIN incorrect

Enter ID to log in, or 0 to quit: 1001

Enter PIN: 111

ID and PIN verified

Enter 1 to add course, 2 to drop course, 3 to list courses, 4 to show bill, 0 to exit: 1

Enter course you want to add: CSC121

Course not found

Enter 1 to add course, 2 to drop course, 3 to list courses, 4 to show bill, 0 to exit: 1

Enter course you want to add: CSC102

You are already enrolled in that course.

Enter 1 to add course, 2 to drop course, 3 to list courses, 4 to show bill, 0 to exit: 1

Enter course you want to add: CSC103

Course already full.

Enter 1 to add course, 2 to drop course, 3 to list courses, 4 to show bill, 0 to exit: 1

Enter course you want to add: CSC101

Course added

Enter 1 to add course, 2 to drop course, 3 to list courses, 4 to show bill, 0 to exit: 4

Course load: 7 credit hours

Enrollment cost: $1575.00

Enter 1 to add course, 2 to drop course, 3 to list courses, 4 to show bill, 0 to exit: 2

Enter course you want to drop: CSC121

Course not found

Enter 1 to add course, 2 to drop course, 3 to list courses, 4 to show bill, 0 to exit: 2

Enter course you want to drop: CSC103

You are not enrolled in that course.

Enter 1 to add course, 2 to drop course, 3 to list courses, 4 to show bill, 0 to exit: 2

Enter course you want to drop: CSC102

Course dropped

Enter 1 to add course, 2 to drop course, 3 to list courses, 4 to show bill, 0 to exit: 3

Courses registered:

CSC101

Total number: 1

Enter 1 to add course, 2 to drop course, 3 to list courses, 4 to show bill, 0 to exit: 1

Enter course you want to add: CSC102

Course added

Enter 1 to add course, 2 to drop course, 3 to list courses, 4 to show bill, 0 to exit: 3

Courses registered:

CSC101

CSC102

Total number: 2

Enter 1 to add course, 2 to drop course, 3 to list courses, 4 to show bill, 0 to exit: 4

Course load: 7 credit hours

Enrollment cost: $1575.00

Enter 1 to add course, 2 to drop course, 3 to list courses, 4 to show bill, 0 to exit: 0

Session ended.

Enter ID to log in, or 0 to quit: 1002

Enter PIN: 222

ID and PIN verified

Enter 1 to add course, 2 to drop course, 3 to list courses, 4 to show bill, 0 to exit: 3

Courses registered:

CSC103

Total number: 1

Enter 1 to add course, 2 to drop course, 3 to list courses, 4 to show bill, 0 to exit: 1

Enter course you want to add: CSC101

Course already full.

Enter 1 to add course, 2 to drop course, 3 to list courses, 4 to show bill, 0 to exit: 1

Enter course you want to add: CSC102

Course added

Enter 1 to add course, 2 to drop course, 3 to list courses, 4 to show bill, 0 to exit: 3

Courses registered:

CSC102

CSC103

Total number: 2

Enter 1 to add course, 2 to drop course, 3 to list courses, 4 to show bill, 0 to exit: 4

Course load: 9 credit hours

Enrollment cost: $7650.00

Enter 1 to add course, 2 to drop course, 3 to list courses, 4 to show bill, 0 to exit: 0

Session ended.

Enter ID to log in, or 0 to quit: 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions

Question

Formal Education explain?

Answered: 1 week ago

Question

Non formal Education explain?

Answered: 1 week ago

Question

Goals of Education System?

Answered: 1 week ago