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

Hotel Room Inheritance

DEMO-OOP-33 โ€ข Object Oriented Programming

Browser-only practice

Problem Statement

Create a hotel-room subclass that extends a room base class and prints the full stay report.

Input Format

Input is given as whitespace-separated tokens for the base-class fields first, followed by the child-class fields.

Output Format

Print the exact multiline report required by the problem.

Sample Testcases

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

Sample #1
Public sample
101
50.0
2
Room: 101
Rate: 50.00
Stay Total: 100.00
Input: room number = "101", nightly rate = 50.0, number of nights = 2.
Key calculation(s): "Room: " + "101" = "Room: 101" | "Rate: " + String.format("%.2f", 50.0) = "Rate: 50.00".
Output:
Room: 101
Rate: 50.00
Stay Total: 100.00
Sample #2
Public sample
202
80.5
3
Room: 202
Rate: 80.50
Stay Total: 241.50
Input: room number = "202", nightly rate = 80.5, number of nights = 3.
Key calculation(s): "Room: " + "202" = "Room: 202" | "Rate: " + String.format("%.2f", 80.5) = "Rate: 80.50".
Output:
Room: 202
Rate: 80.50
Stay Total: 241.50

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