Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. // Brandon Murphy
  2.  
  3. import java.util.*;
  4. public class TempConverter
  5. {
  6. public static void main(String [] args)
  7. {
  8. int tempF = new Int(0);
  9. int tempC = new Int(0);
  10.  
  11. int tempValue = new Int(0);
  12. int tempNew = new Int(0);
  13.  
  14. int conversionType = new Int(0);
  15.  
  16. int fConverter = new Int(1.8);
  17. int cConverter = new Int(0.5555555555555556);
  18.  
  19. System.out.print( "Enter F to convert Fahrenheit, C to convert Celsius. " );
  20. int conversionType = in.nextLine();
  21.  
  22. System.out.print( "Please enter the temperature you would like to convert. " );
  23. int tempVale = in.nextLine();
  24.  
  25. if (conversionType == F){
  26. int tempNew = tempValue - 32;
  27. int tempNew = tempNew * cConverter;
  28.  
  29. System.out.println( tempValue + "in Celsius is" + tempNew);
  30. }
  31.  
  32. if (conversionType == C){
  33. int tempNew = tempValue + 32;
  34. int tempNew = tempNew * fConverter;
  35.  
  36. System.out.println( tempValue + "in Fahrenheit is" + tempNew);
  37. }
  38.  
  39. else {
  40. System.out.println( "Invalid temperature type" );
  41. }
  42.  
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement