Advertisement
YoannaSt173

trubi

Jan 20th, 2020
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.99 KB | None | 0 0
  1. package yoyo;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class trubi {
  6.    
  7.    
  8.    
  9.     public static void main(String[] args){
  10.        
  11.         Scanner scan = new Scanner(System.in);
  12.         //
  13.         int volume = Integer.parseInt(scan.nextLine());
  14.         int pipe1 = Integer.parseInt(scan.nextLine());
  15.         int pipe2 = Integer.parseInt(scan.nextLine());
  16.        
  17.         double hours = Double.parseDouble(scan.nextLine());
  18.         double water = (pipe1 * hours) + (pipe2 * hours);
  19.  
  20.         if(water <= volume){
  21.            
  22.             System.out.printf("The pool is %.0f%% full. Pipe1: %.0f%%. Pipe2: %.0f%%.",
  23.                    
  24.                     Math.floor(water / volume * 100),
  25.                     Math.floor(pipe1 * hours / water * 100),
  26.                     Math.floor(pipe2 * hours / water * 100));
  27.            
  28.         }else{
  29.            
  30.             System.out.printf("For %f hours the pool overflows with %f liters.",
  31.                     hours, water - volume);
  32.            
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement