Advertisement
wreed12345

Untitled

Oct 2nd, 2013
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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 = 'f';
  14.         double answer , temp;
  15.        
  16.         temp = keyboard.nextDouble();
  17.        
  18.         if (temperature.contains("F")) {
  19.             String stringVariable;
  20.             stringVariable = 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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement