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

Safe Price Parser

DEMO-OOP-33 โ€ข Object Oriented Programming

Browser-only practice

Problem Statement

Parse one raw token as a price and print it with two decimals. Handle invalid numeric input.

Input Format

Input is given as whitespace-separated raw tokens exactly in the order described by the problem statement.

Output Format

Print the exact success report or exact error message 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
10.5
Price: 10.50
Input: raw price = "10.5".
Derivation: price = Double.parseDouble("10.5") = 10.5 | "Price: " + "10.50" = "Price: 10.50".
Output:
Price: 10.50
Sample #2
Public sample
99
Price: 99.00
Input: raw price = "99".
Derivation: price = Double.parseDouble("99") = 99.0 | "Price: " + "99.00" = "Price: 99.00".
Output:
Price: 99.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