Guest User

Untitled

a guest
Oct 2nd, 2013
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.84 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Converter {
  4.  
  5.     @SuppressWarnings("null")
  6.     public static void main(String[] args) {
  7.         Scanner keyboard = new Scanner(System.in);
  8.        
  9.         System.out.println("Welcome to the Fahrenheit/Celsius Converter!");
  10.         System.out.println("To convert, type in your temperature and the identify if you are using fahrenheit or celsius.");
  11.         System.out.println("Example: 69F or 69C F = Fahrenheit C = Celsius");
  12.        
  13.         String temperature = null;
  14.         char f = 0, c;
  15.         double answer , temp;
  16.        
  17.         temp = keyboard.nextDouble();
  18.        
  19.         if (temperature.contains("F")) {
  20.             String StringVariable = null;
  21.             StringVariable.replace(f , ' ');
  22.             answer = temp - 30 / 2;
  23.             System.out.println("Poof! The temperature is " + answer + "C");
  24.         } else {
  25.             System.out.println("You entered the temperature wrong!");
  26.            
  27.            
  28.             }
  29.     }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment