Previous Next
0 / 15
Module DEMO-33-70DEMO-OOP-33

Course Enrollment Cap

DEMO-OOP-33 โ€ข Object Oriented Programming

Browser-only practice

Problem Statement

Create Main.java and EnrollmentCap.java.

Implement the class using private fields plus getters and setters.

Use the object to print the required report exactly as described.

Input Format

Input is given as whitespace-separated tokens in the order stated in the question.

Output Format

Print the exact multiline report required by the question.

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
CS1
30
12
Course: CS1
Remaining: 18
Input: course code = "CS1", capacity = 30, registered = 12.
Key calculation(s): "Course: " + getCourseCode() = "Course: CS1" | "Remaining: " + 30 - 12 = "Remaining: 18".
Output:
Course: CS1
Remaining: 18
Sample #2
Public sample
CS2
20
20
Course: CS2
Remaining: 0
Input: course code = "CS2", capacity = 20, registered = 20.
Key calculation(s): "Course: " + getCourseCode() = "Course: CS2" | "Remaining: " + 20 - 20 = "Remaining: 0".
Output:
Course: CS2
Remaining: 0

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings