java Mathematical decimal point error

an2new's Avatar, Join Date: Sep 2011
Newbie Member
Java math error.
I got a prompt asking to covert from Fahrenheit to Celsius and it seem to compiled right and everything but the mathematical solution does not have the right decimal point. I tried everything I know please help. Example if you cal 72 F = 22.22 C...I got 72 F = 22.0 C. Here the program.
import java.util.Scanner;

public class Handout1Project5
    public static void main(String[] args)
        Scanner scannerObject = new Scanner(;
        System.out.println("Hello out there");
        System.out.println("I will converts degrees Fahrenheit to Celsius for you.");
        System.out.println("Enter a temperature in degrees Fahrenheit:  ");
        int user_Input;
        double degrees_Output;
        user_Input = scannerObject.nextInt();
        System.out.println("You entered:" + user_Input);
        degrees_Output = (((user_Input - 32) * 5) / 9);
        System.out.println(user_Input + " degrees Fahrenheit" + " = " + degrees_Output + " Celsius");
        System.out.printf("%d degrees Fahrenheit = %3.2f degrees Celsius %n", user_Input, degrees_Output);

Last edited by shabbir; 5Sep2011 at 10:14.. Reason: Code blocks
an2new's Avatar, Join Date: Sep 2011
Newbie Member
nvm thank you I have found out the solution. Please delete this thread.