CJCoding With Joseph
15free / daySign inCreate account

Read a comma-formatted number string, parse it back to a numeric value with NumberFormat, then reprint it with exactly 2 decimal places.

Use sc.nextLine() to read the string, then NumberFormat.getNumberInstance(Locale.US).parse(text) to convert it. parse() returns a Number object - call .doubleValue() to get a double. The method throws ParseException so main needs throws Exception.

⚠️ AUTO-INPUT MODE: The input stream will automatically contain '12,345.6\n'. Use sc.nextLine() to read it.

Expected output

Parsed: 12345.60

= newline. The output ends with a newline, so print one after the last line.

Hints4 available
Topics
Miscellaneous
Auto-input
12,345.6\n
This input is automatically fed to your program's stdin
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (sysout, psvm, fori)

Your output

Run your code to see the output here...

Test cases

Run your code to see test case results.