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