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