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

Rectangle Report

DEMO-OOP-33 โ€ข Object Oriented Programming

Browser-only practice

Problem Statement

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

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

The report must contain these lines in this order:

  1. Area
  2. Perimeter

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
4
6
Area: 24
Perimeter: 20
Input: width = 4, height = 6.
Key calculation(s): "Area: " + 4 * 6 = "Area: 24" | "Perimeter: " + 2 * (4 + 6) = "Perimeter: 20".
Output:
Area: 24
Perimeter: 20
Sample #2
Public sample
5
5
Area: 25
Perimeter: 20
Input: width = 5, height = 5.
Key calculation(s): "Area: " + 5 * 5 = "Area: 25" | "Perimeter: " + 2 * (5 + 5) = "Perimeter: 20".
Output:
Area: 25
Perimeter: 20

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