can someone give me an idea how I limit the decimals in the output of this code:
/**
* @(#)Text1.java
*
*
* @author Bryan Mark
* @version 1.00 2012/8/4
*/
import java.io.*;
public class Converter
{
public static void main(String[] args)throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
double farenheit, celsius;
System.out.println("Enter a value for Farenheit: ");
farenheit = Double.parseDouble(br.readLine());
celsius = (5.0/9) * farenheit - 32;
System.out.println("Farenheit " + farenheit + " = " + celsius + " Celsius");
}
}
this is a sample output..
Enter a value for Farenheit:
29.5
Farenheit 29.5 = -15.61111111111111 Celsius