Skip to content

Instantly share code, notes, and snippets.

@Spikey3
Created February 10, 2012 03:57
Show Gist options
  • Save Spikey3/1786395 to your computer and use it in GitHub Desktop.
Save Spikey3/1786395 to your computer and use it in GitHub Desktop.
import java.io.*;
public class UserInput {
private static final int F = 0;
public static void main(String[] args){
//the data that will be entered by the user
String name;
//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 F");
try{
Integer C1=(F-32)*5/9;
System.out.println("C is"+C1);
//read the data entered by the user using
//the readLine() method of the BufferedReader class
//and store the value in the name variable
Integer F = reader.readLine();
//print the data entered by the user
System.out.println("C is" + C1);
}
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