Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double firstTime = Double.parseDouble(scanner.nextLine()),
- secondTime = Double.parseDouble(scanner.nextLine()),
- thirdTime = Double.parseDouble(scanner.nextLine()),
- fatherTime = Double.parseDouble(scanner.nextLine()),
- cleaningTime = 1 / (1 / firstTime + 1 / secondTime + 1 / thirdTime) * 1.15;
- System.out.printf("Cleaning time: %.2f\n", cleaningTime);
- if (fatherTime > cleaningTime) {
- System.out.printf("Yes, there is a surprise - time left -> %d hours.\n", (int) (fatherTime - cleaningTime));
- } else {
- System.out.printf("No, there isn't a surprise - shortage of time -> %d hours.\n", (int) Math.ceil(cleaningTime - fatherTime));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement