Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Converter {
- public static void main(String[] args) {
- Scanner keyboard = new Scanner(System.in);
- System.out.println("Welcome to the Fahrenheit/Celsius Converter!");
- System.out.println("To convert, type in your temperature and the identify if you are using fahrenheit or celsius.");
- System.out.println("Example: 69F or 69C F = Fahrenheit C = Celsius");
- String temperature;
- char f = 'f';
- double answer , temp;
- temp = keyboard.nextDouble();
- if (temperature.contains("F")) {
- String StringVariable = null;
- StringVariable.replace(f , '');
- answer = temp - 30 / 2;
- System.out.println("Poof! The temperature is " + answer + "C");
- } else {
- System.out.println("You entered the temperature wrong!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement