Advertisement
Spocoman

Three brothers

Sep 10th, 2024
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.91 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         double firstTime = Double.parseDouble(scanner.nextLine()),
  7.                 secondTime = Double.parseDouble(scanner.nextLine()),
  8.                 thirdTime = Double.parseDouble(scanner.nextLine()),
  9.                 fatherTime = Double.parseDouble(scanner.nextLine()),
  10.                 cleaningTime = 1 / (1 / firstTime + 1 / secondTime + 1 / thirdTime) * 1.15;
  11.  
  12.         System.out.printf("Cleaning time: %.2f\n", cleaningTime);
  13.         if (fatherTime > cleaningTime) {
  14.             System.out.printf("Yes, there is a surprise - time left -> %d hours.\n", (int) (fatherTime - cleaningTime));
  15.         } else {
  16.             System.out.printf("No, there isn't a surprise - shortage of time -> %d hours.\n", (int) Math.ceil(cleaningTime - fatherTime));
  17.         }
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement