Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class demo {
- 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 time = 1/ (1/a + 1/b + 1/c);
- double rest = time * 0.15;
- double totalTime = time + rest;
- if(d > totalTime){
- double timeLeft = Math.floor(d - totalTime);
- System.out.printf("Cleaning time: %.2f\n" +
- "Yes, there is a surprise - time left -> %.0f hours.\n", totalTime, timeLeft);
- }else{
- double timeNeeded = Math.ceil(totalTime - d);
- System.out.printf("Cleaning time: %.2f\n" +
- "No, there isn't a surprise - shortage of time -> %.0f hours.\n", totalTime, timeNeeded);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement