Advertisement
Guest User

Untitled

a guest
Feb 14th, 2018
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.98 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Playground {
  4.  
  5.     public static void main(String[] args) {
  6.         Scanner scanner = new Scanner(System.in);
  7.  
  8.         double brotherOneTime = Double.parseDouble(scanner.nextLine());
  9.         double brotherTwoTime = Double.parseDouble(scanner.nextLine());
  10.         double brotherThreeTime = Double.parseDouble(scanner.nextLine());
  11.         double fatherAbsentTime = Double.parseDouble(scanner.nextLine());
  12.  
  13.         double cleaningTime = (1.0 / (1.0 / brotherOneTime + 1.0 / brotherTwoTime + 1.0 / brotherThreeTime)) * 1.15;
  14.  
  15.         double timeLeft = fatherAbsentTime - cleaningTime;
  16.  
  17.         if (timeLeft >= 0.0) {
  18.             System.out.printf("Cleaning time: %.2f%nYes, there is a surprise - time left -> %.0f hours.", cleaningTime, Math.floor(timeLeft));
  19.         } else {
  20.             System.out.printf("Cleaning time: %.2f%nNo, there isn't a surprise - shortage of time -> %.0f hours.", cleaningTime, Math.ceil(-timeLeft));
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement