Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package yoyo;
- import java.util.Scanner;
- public class trubi {
- public static void main(String[] args){
- Scanner scan = new Scanner(System.in);
- //
- int volume = Integer.parseInt(scan.nextLine());
- int pipe1 = Integer.parseInt(scan.nextLine());
- int pipe2 = Integer.parseInt(scan.nextLine());
- double hours = Double.parseDouble(scan.nextLine());
- double water = (pipe1 * hours) + (pipe2 * hours);
- if(water <= volume){
- System.out.printf("The pool is %.0f%% full. Pipe1: %.0f%%. Pipe2: %.0f%%.",
- Math.floor(water / volume * 100),
- Math.floor(pipe1 * hours / water * 100),
- Math.floor(pipe2 * hours / water * 100));
- }else{
- System.out.printf("For %f hours the pool overflows with %f liters.",
- hours, water - volume);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement