Advertisement
Guest User

Untitled

a guest
Feb 14th, 2018
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.05 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Ex2 {
  4.     public static void main(String[] args) {
  5.  
  6.         Scanner scanner = new Scanner(System.in);
  7.  
  8.         double a = Double.parseDouble(scanner.nextLine());
  9.         double b = Double.parseDouble(scanner.nextLine());
  10.         double c = Double.parseDouble(scanner.nextLine());
  11.         double d = Double.parseDouble(scanner.nextLine());
  12.  
  13.         double CleaningTime = (1 / (1 / a + 1 / b + 1 / c)) + ((1 / (1 / a + 1 / b + 1 / c)) * 0.15);
  14.  
  15.         double Timeleft = d - CleaningTime;
  16.  
  17.         if (a <= 99) {
  18.             if (a >= 0) {
  19.                 if (b <= 99) {
  20.                     if (b >= 0) {
  21.                         if (c <= 99) {
  22.                             if (c >= 0) {
  23.                                 if (d <= 99) {
  24.                                     if (d >= 0) {
  25.                                         if (d > CleaningTime) {
  26.                                             System.out.printf("Cleaning time: %.2f%nYes, there is a surprise - time left -> %.0f hours.", CleaningTime, Math.floor(Timeleft));
  27.                                         } else if (d < CleaningTime) {
  28.                                             System.out.printf("Cleaning time: %.2f%nNo, there isn't a surprise - shortage of time -> %.0f hours.", CleaningTime, Math.ceil(Math.abs(Timeleft)));
  29.                                         } else System.out.println("Insert number from 0 to 99");
  30.                                     } else System.out.println("Insert number from 0 to 99");
  31.                                 } else System.out.println("Insert number from 0 to 99");
  32.                             } else System.out.println("Insert number from 0 to 99");
  33.                         } else System.out.println("Insert number from 0 to 99");
  34.                     }else System.out.println("Insert number from 0 to 99");
  35.                 }else System.out.println("Insert number from 0 to 99");
  36.             }else System.out.println("Insert number from 0 to 99");
  37.         }else System.out.println("Insert number from 0 to 99");
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement