Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function PipesInPool(input) {
- let volume = parseFloat(input[0]);
- let pipe1 = parseFloat(input[1]);
- let pipe2 = parseFloat(input[2]);
- let hour = parseFloat(input[3]);
- let poolV = (pipe1 + pipe2) * hour;
- let poolP = poolV / volume;
- if (volume >= poolV) {
- console.log(`The pool is ${(poolP * 100).toFixed(2)}% full. Pipe 1: ${(pipe1 / poolV * hour * 100).toFixed(2)}%. Pipe 2: ${(pipe2 / poolV * hour * 100).toFixed(2)}%.`);
- }
- else {
- console.log(`For ${hour} hours the pool overflows with ${(poolV - volume).toFixed(2)} liters.`);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement