Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Playground {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double brotherOneTime = Double.parseDouble(scanner.nextLine());
- double brotherTwoTime = Double.parseDouble(scanner.nextLine());
- double brotherThreeTime = Double.parseDouble(scanner.nextLine());
- double fatherAbsentTime = Double.parseDouble(scanner.nextLine());
- double cleaningTime = (1.0 / (1.0 / brotherOneTime + 1.0 / brotherTwoTime + 1.0 / brotherThreeTime)) * 1.15;
- double timeLeft = fatherAbsentTime - cleaningTime;
- if (timeLeft >= 0.0) {
- System.out.printf("Cleaning time: %.2f%nYes, there is a surprise - time left -> %.0f hours.", cleaningTime, Math.floor(timeLeft));
- } else {
- System.out.printf("Cleaning time: %.2f%nNo, there isn't a surprise - shortage of time -> %.0f hours.", cleaningTime, Math.ceil(-timeLeft));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement