Advertisement
Spocoman

Easter Bakery

Feb 21st, 2022
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function easterBakery(input) {
  2.     let flourKg = Number(input.shift());
  3.     let flourPrice = Number(input.shift());
  4.     let sugarKg = Number(input.shift());
  5.     let eggPack = Number(input.shift());
  6.     let yeast = Number(input.shift());
  7.    
  8.     let flourTotal = flourKg * flourPrice;
  9.     let sugarTotal = flourKg * sugarKg * 0.75;
  10.     let eggPackTotal = flourKg * eggPack * 1.1;
  11.     let yeastTotal = flourKg * 0.75 * yeast * 0.2;
  12.     let sum = flourTotal + sugarTotal + eggPackTotal + yeastTotal;
  13.  
  14.     console.log(`${sum.toFixed(2)}`);
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement