Advertisement
Guest User

Untitled

a guest
Jun 19th, 2017
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class main {
  4.  
  5. static double Far_Cel(double t){
  6. double temp = 5/9.0;
  7. return (temp*(t-32));
  8. }
  9.  
  10. static double Cel_Far(double t){
  11. double temp = 9/5.0;
  12. return (temp*t+32);
  13. }
  14.  
  15. public static void main(String[] args){
  16. Scanner sc = new Scanner(System.in);
  17.  
  18. String exit = "NO";
  19.  
  20. while(!exit.equals("YES")){
  21.  
  22. System.out.println("Что ты хочешь? \n1) Фарингейт в Цельсий \n2) Цельсий в Фарингейт ");
  23. int value = sc.nextInt();
  24.  
  25. if(value == 1){ //Far_Cel
  26. System.out.println("Введи Фарингейты");
  27. double t = sc.nextDouble();
  28. System.out.println("C="+Far_Cel(t));
  29. }
  30. if(value == 2){
  31. System.out.println("Введи Цельсий");
  32. double t = sc.nextDouble();
  33. System.out.println("F="+Cel_Far(t));
  34. }
  35.  
  36. System.out.println("Хочешь ли ты выйти? YES or NO");
  37. exit = sc.next();
  38. }
  39.  
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement