Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package test;
- import java.util.Scanner;
- public class ThreeBrothers {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- Double a = Double.parseDouble(scan.nextLine());
- Double b = Double.parseDouble(scan.nextLine());
- Double c = Double.parseDouble(scan.nextLine());
- Double d = Double.parseDouble(scan.nextLine());
- Double obshto = 1/(1/a+1/b+1/c);
- Double pochivka = obshto+(obshto*.15);
- Double ostatuk = d - pochivka;
- String yes ="Yes, there is a surprise - time left -> ";
- String no = "No, there isn't a surprise - shortage of time -> ";
- String clean = "Cleaning time: ";
- System.out.printf("%.2f, %s, %n", clean+pochivka);
- if (d > pochivka){
- System.out.printf("%.0f, %s",no +ostatuk +" hours.");}
- else {
- System.out.printf("%.0f %s",yes + ostatuk +" hours.");}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement