SHARE
TWEET

Untitled

a guest Feb 24th, 2020 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function bisquitsFactory(
  2.   bisquitsPerDayPerWorker,
  3.   workers,
  4.   competeFactoryCapacityPer30Days
  5. ) {
  6.   let bisquitsSum = 0;
  7.  
  8.   for (let day = 1; day <= 30; day++) {
  9.     let bisquitsPerDay = parseInt(bisquitsPerDayPerWorker * workers);
  10.     if (day % 3 === 0) {
  11.       bisquitsPerDay = parseInt(bisquitsPerDay * 0.75);
  12.     }
  13.     bisquitsSum += bisquitsPerDay;
  14.   }
  15.  
  16.   console.log(`You have produced ${bisquitsSum} biscuits for the past month.`);
  17.  
  18.   let diff = Math.abs(competeFactoryCapacityPer30Days - bisquitsSum);
  19.   let percentage = ((diff / competeFactoryCapacityPer30Days) * 100).toFixed(2);
  20.  
  21.   if (competeFactoryCapacityPer30Days > bisquitsSum) {
  22.     console.log(`You produce ${percentage} percent less biscuits.`);
  23.   } else {
  24.     console.log(`You produce ${percentage} percent more biscuits.`);
  25.   }
  26. }
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