Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. //Robert Corrato
  2. //9/6/19
  3. //B Block
  4.  
  5.  
  6. import java.util.*;
  7.  
  8. class TemperatureGameOTG{
  9. public static void main(String[] args) {
  10. int temperature;
  11. int answer;
  12. Scanner sc = new Scanner(System.in);
  13. System.out.println("Do you want to convert fahrenheit or celcius?"xxl)
  14. answer = sc.nextLine();
  15. if (answer = "fahrenheit"){
  16.  
  17. System.out.println("Enter temperature in fahrenheit");
  18. temperature = sc.nextInt();
  19.  
  20. temperature = ((temperature - 32)*5)/9;
  21.  
  22. System.out.println("The temperature in celsius is " + temperature);
  23. }
  24. else
  25. {
  26. System.out.println("Enter temperature in celcius");
  27. temperature = sc.nextInt();
  28.  
  29. temperature = ((temperature (9.0/5 * C)) + 32;
  30.  
  31. System.out.println("The temperature in fahrenheit is " + temperature);
  32. }
  33.  
  34. }
  35. }
  36. System.out.println("Convert another temperature? 1 for yes.");
  37. int playAgain = sc.nextInt();
  38. if (playAgain != 1){
  39. play = true;
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement