Advertisement
Edzhevit

ThreeBrothers

Sep 18th, 2018
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. package OldExams;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class ThreeBrothers {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8. double Time1 = Double.parseDouble(scanner.nextLine());
  9. double Time2 = Double.parseDouble(scanner.nextLine());
  10. double Time3 = Double.parseDouble(scanner.nextLine());
  11. double Father = Double.parseDouble(scanner.nextLine());
  12. double total = 1 / (1 / Time1 + 1 / Time2 + 1 / Time3);
  13. total = total + (total * 0.15);
  14. System.out.printf("Cleaning time: %.2f%n", total);
  15.  
  16. if (total < Father) {
  17. System.out.printf("Yes, there is a surprise - time left -> %.0f hours.", Math.floor(Father - total));
  18. }else {
  19. System.out.printf("No, there isn't a surprise - shortage of time -> %.0f hours.", Math.ceil(total - Father));
  20. }
  21.  
  22.  
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement