Previous
0 / 15
Module DEMO-33-69DEMO-OOP-33

Dorm Room Allocator

DEMO-OOP-33 โ€ข Object Oriented Programming

Browser-only practice

Problem Statement

Create two Java files: Main.java and DormAllocation.java.

Read the required values, construct a DormAllocation object, and print a multiline report.

The report must contain these lines in this order:

  1. Student
  2. Free Beds
  3. Fee

Use a constructor and keep the object-oriented structure clear.

Input Format

Input is provided as separate whitespace-separated tokens in the same order described in the problem statement.

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
ST1
4
2
55.0
Student: ST1
Free Beds: 2
Fee: 55.00
Input: student code = "ST1", room capacity = 4, current residents = 2, monthly fee = 55.0.
Key calculation(s): "Student: " + "ST1" = "Student: ST1" | "Free Beds: " + 4 - 2 = "Free Beds: 2".
Output:
Student: ST1
Free Beds: 2
Fee: 55.00
Sample #2
Public sample
ST2
2
2
70.0
Student: ST2
Free Beds: 0
Fee: 70.00
Input: student code = "ST2", room capacity = 2, current residents = 2, monthly fee = 70.0.
Key calculation(s): "Student: " + "ST2" = "Student: ST2" | "Free Beds: " + 2 - 2 = "Free Beds: 0".
Output:
Student: ST2
Free Beds: 0
Fee: 70.00

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