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

Mouse Distance Panel

DEMO-OOP-33 โ€ข Object Oriented Programming

Browser-only practice

Problem Statement

Create a Swing panel that listens for mouse movement and updates the label with the distance from the origin.

Input Format

Input is given as whitespace-separated values and is used by Main.java to simulate the GUI interaction.

Output Format

Print the final label text returned by the simulation.

Sample Testcases

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

Sample #1
Public sample
3
4
Distance: 5.00
Input: mouse x = 3, mouse y = 4.
Derivation: distance = sqrt(3^2 + 4^2) = sqrt(9 + 16) = sqrt(25) = 5.00 | "Distance: " + "5.00" = "Distance: 5.00".
Final label text:
Distance: 5.00
Sample #2
Public sample
6
8
Distance: 10.00
Input: mouse x = 6, mouse y = 8.
Derivation: distance = sqrt(6^2 + 8^2) = sqrt(36 + 64) = sqrt(100) = 10.00 | "Distance: " + "10.00" = "Distance: 10.00".
Final label text:
Distance: 10.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