Skip to content

Instantly share code, notes, and snippets.

Created February 10, 2012 05:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/1787021 to your computer and use it in GitHub Desktop.
Save anonymous/1787021 to your computer and use it in GitHub Desktop.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class aargih{
public static void main(String[] args){
//the data that will be entered by the user
String farenheit1;
//an instance of the BufferedReader class
//will be used to read the data
BufferedReader reader;
//specify the reader variable
//to be a standard input buffer
reader = new BufferedReader(new InputStreamReader(System.in));
//ask the user for their name
System.out.print("What is the farenheit?");
try{
//read the data entered by the user using
//the readLine() method of the BufferedReader class
//and store the value in the name variable
farenheit1 = reader.readLine();
Integer farenheit =
Integer celcius = (farenheit-32)*5/9;
//print the data entered by the user
System.out.println("The celcius is " + farenheit);
}
catch (IOException ioe){
//statement to execute if an input/output exception occurs
System.out.println("An unexpected error occured.");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment