0

How to change "," to "." in the terminal.

Having coded a simple cash register in java within blueJ, each time i want to enter decimal numbers with a "." it crashes. It would be really useful considering that the numpad has it close. Thank you!

30th Jan 2017, 12:23 AM
Antoine Dino-Robot
Antoine Dino-Robot - avatar
1 Réponse
+ 14
The code you published works for doubles... If you want to use "," as a decimal separator, use nextLine to accept a string. After that, use String's replace method to replace "," by "." and cast it to double.
26th Mar 2017, 4:21 PM
Tashi N
Tashi N - avatar