Advertisement
finderabc

ThreeBrothers

Nov 16th, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.96 KB | None | 0 0
  1. package IzpitZadachi.b_Second;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class ThreeBrothers {
  6.     public static void main(String[] args) {
  7.         Scanner scan = new Scanner(System.in);
  8.         Double a = Double.parseDouble(scan.nextLine());
  9.         Double b = Double.parseDouble(scan.nextLine());
  10.         Double c = Double.parseDouble(scan.nextLine());
  11.         Double d = Double.parseDouble(scan.nextLine());
  12.  
  13.         Double cleaningtime = 1 / (1 / a + 1 / b + 1 / c);
  14.         cleaningtime = cleaningtime + (cleaningtime * 0.15);
  15.         System.out.printf("Cleaning time: %.2f%n", cleaningtime);
  16.  
  17.         if (cleaningtime < d) {
  18.             System.out.printf("Yes, there is a surprise - time left -> %.0f hours.",
  19.                     Math.floor(d - cleaningtime));
  20.  
  21.         } else {
  22.  
  23.             System.out.printf("No, there isn't a surprise - shortage of time -> %.0f hours.",
  24.                     Math.ceil(cleaningtime - d));
  25.         }
  26.  
  27.  
  28.     }
  29.  
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement