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