Name: Anonymous 2009-02-18 0:06
I need to convert a user inputted temperature from Celsius to Fahrenheit. this is what I have so far:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) {
privateMain(args);
}
private static void privateMain(String[] privateArgs) {
System.out.println("Enter C or F <return>");
BufferedReader in =
new BufferedReader(new InputStreamReader(System.in));
String type = null;
try {
type = in.readLine();
} catch (IOException e) {
e.printStackTrace();
}
if (type=);
{
//statements
}
else
//statements
System.out.println("Converted is: " + temp);
}
}
How do I take the input, read it as Celsius or Fahrenheit, and convert it with the if statement? And i know I suck at programming, so you don't have to tell me
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) {
privateMain(args);
}
private static void privateMain(String[] privateArgs) {
System.out.println("Enter C or F <return>");
BufferedReader in =
new BufferedReader(new InputStreamReader(System.in));
String type = null;
try {
type = in.readLine();
} catch (IOException e) {
e.printStackTrace();
}
if (type=);
{
//statements
}
else
//statements
System.out.println("Converted is: " + temp);
}
}
How do I take the input, read it as Celsius or Fahrenheit, and convert it with the if statement? And i know I suck at programming, so you don't have to tell me