AreWe

Biscuit Factory differences

Jun 14th, 2020
1,288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [ 80/100 ]
  2. biscuitsFactory = ([ perWorkerADay, workers, competition ]) => {
  3.     perWorkerADay = Number(perWorkerADay);
  4.     workers = Number(workers);
  5.     competition = Number(competition);
  6.     let biscuits = perWorkerADay * workers * 20 + Math.floor(perWorkerADay * workers * 10 * 0.75);
  7.     let percent = 100 / competition * biscuits - 100;
  8.     console.log(`You have produced ${biscuits} biscuits for the past month.`);
  9.     console.log(biscuits > competition ? `You produce ${percent.toFixed(2)} percent more biscuits.` : `You produce ${Math.abs(percent).toFixed(2)} percent less biscuits.`);
  10. }
  11.  
  12. [ 100/100 ]
  13. biscuitsFactory = ([ perWorkerADay, workers, competition ]) => {
  14.     perWorkerADay = Number(perWorkerADay);
  15.     workers = Number(workers);
  16.     competition = Number(competition);
  17.     let biscuits = perWorkerADay * workers * 20 + Math.floor(perWorkerADay * workers * .75) * 10;
  18.     let percent = 100 / competition * biscuits - 100;
  19.     console.log(`You have produced ${biscuits} biscuits for the past month.`);
  20.     console.log(biscuits > competition ? `You produce ${percent.toFixed(2)} percent more biscuits.` : `You produce ${Math.abs(percent).toFixed(2)} percent less biscuits.`);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment