← Back to Community
Homework; pipes in a swimming pool
Profile icon
MariaStoyanova1

Hello,everyone!
I need some guideness ...
I have homework and the task is,as written:
"A pool has two pipes that fill it and volume V. Each pipe has a certain flow rate (liter of water passing through one pipe per hour). The worker runs the pipes at the same time and goes out for N hours. Write down a program that takes the condition of the pool at the moment the worker returns.
Input data:
Four rows are read from the console:
The first row contains the number V - volume of the pool in liters - an integer in the range [1 ... 10000].
The second row contains the number P1 - the flow of the first pipe per hour - an integer in the range [1 ... 5000].
The third row contains the number P2 - the second pipe flow per hour - an integer in the range [1 ... 5000].
The fourth row contains the number H - the hours in which the worker is absent - a floating point in the range [1.0 ... 24.00]

Output data:
Print one of two possible states on the console:

```.css-19sk4h4{position:relative;}.css-1bu6gr6{-webkit-align-items:stretch;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;border-width:0;border-style:solid;box-sizing:border-box;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-basis:auto;-ms-flex-preferred-size:auto;flex-basis:auto;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;outline:none;min-height:0;min-width:0;position:relative;}.css-1n2m10r{padding:var(--space-8);border-radius:var(--border-radius-4);background-color:var(--background-higher);}.css-1hwur6u{-webkit-align-items:stretch;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;border-width:0;border-style:solid;box-sizing:border-box;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-basis:auto;-ms-flex-preferred-size:auto;flex-basis:auto;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;outline:none;min-height:0;min-width:0;padding:var(--space-8);border-radius:var(--border-radius-4);background-color:var(--background-higher);}.css-1ubbl1f{padding:var(--space-4);padding-left:var(--space-4);padding-right:var(--space-2);font-family:var(--font-family-code);font-size:14px;line-height:var(--line-height-small);overflow-x:auto;word-break:break-word;white-space:break-spaces;overflow-wrap:anywhere;}```How far the pool has been filled and how each  pipe has contributed to the percentage. At all percentages, take only the whole portion (ie, round off).
"Pipe 1: [y]% Pipe 2: [z]%."
If the pool is overflowing - how many liters it has overflowed for a given time, a floating point number.
"For [x] hours, the pool overflows with [y] liters."``````

I have to use Math.floor() and System.out.printf() in Java