SHOW:
|
|
- or go back to the newest paste.
1 | import java.util.Scanner; | |
2 | ||
3 | public class Converter { | |
4 | ||
5 | public static void main(String[] args) { | |
6 | Scanner keyboard = new Scanner(System.in); | |
7 | ||
8 | System.out.println("Welcome to the Fahrenheit/Celsius Converter!"); | |
9 | System.out.println("To convert, type in your temperature and the identify if you are using fahrenheit or celsius."); | |
10 | System.out.println("Example: 69F or 69C F = Fahrenheit C = Celsius"); | |
11 | ||
12 | String temperature; | |
13 | - | char f = 0, c; |
13 | + | char f = 'f'; |
14 | double answer , temp; | |
15 | ||
16 | temp = keyboard.nextDouble(); | |
17 | ||
18 | if (temperature.contains("F")) { | |
19 | String StringVariable = null; | |
20 | - | StringVariable.replace(f , ' '); |
20 | + | StringVariable.replace(f , ''); |
21 | answer = temp - 30 / 2; | |
22 | System.out.println("Poof! The temperature is " + answer + "C"); | |
23 | } else { | |
24 | System.out.println("You entered the temperature wrong!"); | |
25 | ||
26 | ||
27 | } | |
28 | } | |
29 | ||
30 | } |