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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started