How can I fix this problem with my Java code
if (buttonText.equals(“C”)) { if (dataToCalculate == null || dataToCalculate.isEmpty()) { Toast.makeText(this, “No values to delete”, Toast.LENGTH_SHORT).show(); resultTv.setText(“0”); } else { if (dataToCalculate.length() > 1) { dataToCalculate = dataToCalculate.substring(0, dataToCalculate.length() – 1); } else { dataToCalculate = “”; // Clear if only one character remains resultTv.setText(“0”); } solutionTv.setText(dataToCalculate); if (!dataToCalculate.isEmpty()) { String finalResult = getResult(dataToCalculate); if […]
Can’t use “0.3” but can use “0,3” in simple Java Calculator
I am currently learning Java and my first project is a simple calculator.
For some reason it does not accept decimal numbers that have “.” in them, but does accept “,”
I can use “0,4 + 0,4” but it won’t work with “0.4 + 0.4”
How to make a calc in java as I am getting stuck with a bit of a problem (Without using any import other than scanner)
I wanted to make a calculator that is capable to do code with 2,3 or 4 values.