SHARE
TWEET

Untitled

a guest Mar 26th, 2020 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function renovation(input) {
  2.     let high = Number(input.shift());
  3.     let width = Number(input.shift());
  4.     let percentOpenSpace = Number(input.shift());
  5.  
  6.     let wallPaintingArea = 4 * high * width * (100 - percentOpenSpace) / 100;
  7.     let paint = input.shift();
  8.     let isFinish = false;
  9.  
  10.     while (paint !== "Tired!" || wallPaintingArea === 0) {
  11.         wallPaintingArea -= Number(paint);
  12.         if (wallPaintingArea <= 0) {
  13.             isFinish = true;
  14.             break;
  15.         }
  16.         paint = input.shift();
  17.     }
  18.  
  19.     if (paint === "Tired!") {
  20.         console.log(`${wallPaintingArea} quadratic m left.`);
  21.     }
  22.  
  23.     if (wallPaintingArea < 0 && paint !== "Tired!") {
  24.         console.log(`All walls are painted and you have ${Math.abs(wallPaintingArea)} l paint left!`);
  25.     }
  26.     else if (wallPaintingArea >= 0 && paint !== "Tired!"){
  27.         console.log(`All walls are painted! Great job, Pesho!`);
  28.     }    
  29. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top