Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function harvest(input){
- let x = parseFloat(input[0]);
- let y = parseFloat(input[1]);
- let z = parseFloat(input[2]);
- let workers = parseInt(input[3]);
- let wine = 0.4 * x * y / 2.5;
- if (wine < z) {
- console.log(`It will be a tough winter! More ${Math.floor(z - wine)} liters wine needed.`);
- } else {
- console.log(`Good harvest this year! Total wine: ${Math.floor(wine)} liters.`);
- console.log(`${Math.ceil(wine - z)} liters left -> ${Math.ceil((wine - z) / workers)} liters per person.`);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement