SHARE
TWEET

Untitled

a guest Sep 19th, 2019 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class test3 {
  4.  
  5.     public static void main(String[] args) {
  6.         Scanner in = new Scanner(System.in);
  7.         int v = Integer.parseInt(in.nextLine());
  8.         int p1 = Integer.parseInt(in.nextLine());
  9.         int p2 = Integer.parseInt(in.nextLine());
  10.         double h = Double.parseDouble(in.nextLine());
  11.         in.close();
  12.         double p1all = p1 * h;
  13.         double p2all = p2 * h;
  14.         if (p1all + p2all < v) {
  15.             System.out.printf("The pool is %.2f full. Pipe 1: %.2f%%. Pipe 2: %.2f%%.", (p1all + p2all) * 100 / v,
  16.                     p1all * 100 / (p1all + p2all), p2all * 100 / (p1all + p2all));
  17.         } else {
  18.             System.out.printf("For %.2f hours the pool overflows with %.2f liters.", h, p1all + p2all - v);
  19.         }
  20.     }
  21. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top