Advertisement
jayadamsmorgan

Untitled

Dec 20th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5. public static void main(String[] args) {
  6. Scanner scanner = new Scanner(System.in);
  7. double t0 = scanner.nextDouble();
  8. double th = scanner.nextDouble();
  9. double tc = scanner.nextDouble();
  10. double t = scanner.nextDouble();
  11. if (t0 > t) {
  12. System.out.print("cooler ");
  13. double res = (t0 - t) / tc;
  14. res *= 100d;
  15. res = Math.round(res);
  16. res /= 100d;
  17. System.out.print(res);
  18. } else {
  19. System.out.print("heater ");
  20. double res = (t - t0) / th;
  21. res *= 100d;
  22. res = Math.round(res);
  23. res /= 100d;
  24. System.out.print(res);
  25. }
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement