Question: Write Comments for each line Explain codes Define a Course Enrollment class that tracks the number of students enrolled in a particular course. The classroom

Write Comments for each line

Explain codes

Define a Course Enrollment class that tracks the number of students enrolled in a particular course. The classroom should have fields for the course name, the number of enrolled students, the maximum class size, and accessor methods to access and print these fields. The classroom will also have an enrollment method to update (increase / decrease) the number of students enrolled. Students should not be allowed to enroll and a warning message should be displayed when the maximum class size is reached. Also remember to always check if the number of students is greater than or equal to zero. For the CourseRegisration class, implement two subclasses, UndergradCourse and GradCourse:

The enrollment method of the Undergraduate Course class must allow only undergraduate students to enroll.

GradCourse class must have an enrollment quota for undergraduate students. The enrollment method of the GradCourse class should allow the enrollment of undergraduate students until this quota is filled.

Write a test code called TestRegistration to demonstrate that different enrollment scenarios produce the correct output: Scenario 1: Undergraduate course with a maximum size of 20; Attempting to enroll 10 undergraduates, then 3 undergraduate students, then 15 undergraduate students, then unregister 7 undergraduate students Scenario 2: Maximum 10 undergraduate, undergraduate 4 quotas; 5 bachelors, then try to enroll 6 alumni, then delete 1 undergraduate enrollment and enroll 4 alumni

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!