Advertisement
AlexandrP

Christmas_Preparation

Dec 17th, 2022
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function christmasPreparation(input) {
  2.  
  3.     let paper = 5.80;
  4.     let plat = 7.20;
  5.     let glue = 1.20;
  6.  
  7.     let paperCount = Number(input[0]);
  8.     let platCount = Number(input[1]);
  9.     let glueLiters = Number(input[2]);
  10.     let discountPercent = Number(input[3]);
  11.  
  12.     let total = (paperCount * paper) + (platCount * plat) + (glueLiters * glue);
  13.     let discountAmount = (total * discountPercent) / 100;
  14.     total -= discountAmount;
  15.  
  16.     console.log(total.toFixed(3));
  17. }
  18.  
  19. christmasPreparation(["4",
  20.     "2",
  21.     "5",
  22.     "13"])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement