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

Sensor Range Summary

DEMO-OOP-33 โ€ข Object Oriented Programming

Browser-only practice

Problem Statement

Create a helper class that uses the Java Math API to report the minimum, maximum, and spread of three sensor readings.

Input Format

Input is given as whitespace-separated tokens in this order:

  1. first reading
  2. second reading
  3. third reading

Output Format

Print the exact report in this order:

  1. Min
  2. Max
  3. Spread

Sample Testcases

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

Sample #1
Public sample
10.5
8.0
12.25
Min: 8.00
Max: 12.25
Spread: 4.25
Input: first reading = 10.5, second reading = 8.0, third reading = 12.25.
Key calculation(s): minimum = Math.min(10.5, Math.min(8.0, 12.25)) | maximum = Math.max(10.5, Math.max(8.0, 12.25)) | "Min: " + String.format("%.2f", minimum) = "Min: 8.00".
Output:
Min: 8.00
Max: 12.25
Spread: 4.25
Sample #2
Public sample
5.0
5.0
9.5
Min: 5.00
Max: 9.50
Spread: 4.50
Input: first reading = 5.0, second reading = 5.0, third reading = 9.5.
Key calculation(s): minimum = Math.min(5.0, Math.min(5.0, 9.5)) | maximum = Math.max(5.0, Math.max(5.0, 9.5)) | "Min: " + String.format("%.2f", minimum) = "Min: 5.00".
Output:
Min: 5.00
Max: 9.50
Spread: 4.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