Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Computer Science Python: Build a program that allows you to store a class schedule for a group of students. add_student(name [string]) => returns student_id [int]

Computer Science

Python: Build a program that allows you to store a class schedule for a group of students. add_student(name [string]) => returns student_id [int] add_class(student_id, days_of_week, start_time, end_time) => None (if successful) OR throw an error if the times overlap with another class the student has total_class_time(student_id) => returns hours [int] (the number of hours free that the student is spending in class from Monday-Friday) Use military time for start time and end time, for example 6pm = 1800. Days of week should be a string in the form "MTWRF", where R represents Thursday, that stands for the days the class is on. So, for example, a class that is every Tuesday and Thursday from 4pm to 6pm for a student with id 2 would be: `add_class(2, "TR", 1600, 1800)`. Use the `unittest` module's assertEqual and assertRaises functions to test the following situations: - Creating a student when 4 students already exist returns id of 5 - Adding a class on a day student has other classes that don't overlap is successful - Adding a class that overlaps with another class throws an error - Checking total class time when student has no classes returns 0 - Checking total class time when student has a bunch of classes scheduled returns correct number

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions