I'm having a problem getting a proper output for a division function. I have defined the variable as double, but the output comes out rounded to the decimal place X.0.
Ex: 10/3 comes out as 3.0
What do I need to change in order to make double give me a full decimal output?
Here is the source code for the division method:
public void Divide() { CalcInput user = new CalcInput(); String userInput = user.getUserInput(" "); int input1 = Integer.parseInt(userInput); System.out.println(" " + input1 + "/"); String userInput2 = user.getUserInput(" "); int input2 = Integer.parseInt(userInput2); System.out.println("Input was " + input1 + "/" + input2); double output = input1/input2; System.out.println(""); System.out.println(" " + output); } }