Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. package test;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class ThreeBrothers {
  6. public static void main(String[] args) {
  7. Scanner scan = new Scanner(System.in);
  8. Double a = Double.parseDouble(scan.nextLine());
  9. Double b = Double.parseDouble(scan.nextLine());
  10. Double c = Double.parseDouble(scan.nextLine());
  11. Double d = Double.parseDouble(scan.nextLine());
  12.  
  13. Double obshto = 1/(1/a+1/b+1/c);
  14. Double pochivka = obshto+(obshto*.15);
  15. Double ostatuk = d - pochivka;
  16.  
  17. String yes ="Yes, there is a surprise - time left -> ";
  18. String no = "No, there isn't a surprise - shortage of time -> ";
  19. String clean = "Cleaning time: ";
  20.  
  21. System.out.printf("%.2f, %s, %n", clean+pochivka);
  22.  
  23. if (d > pochivka){
  24. System.out.printf("%.0f, %s",no +ostatuk +" hours.");}
  25. else {
  26. System.out.printf("%.0f %s",yes + ostatuk +" hours.");}
  27.  
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement