Advertisement
Grossos

PercentFix Discount Chrismas

Jun 25th, 2023 (edited)
814
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function chrismas(input) {
  2.  
  3.     let broiHartiq = Number(input[0]);
  4.     let broiPlat = Number(input[1]);
  5.     let broiLepilo = Number(input[2]);
  6.     let percent = Number(input[3]);
  7.  
  8.     let hartiq = 5.80 * broiHartiq;
  9.     let plat = 7.20 * broiPlat;
  10.     let lepilo = 1.20 * broiLepilo;
  11.  
  12.     let total = hartiq + plat + lepilo;
  13.  
  14.     let percentFix = (100 - percent) / 100; // percent отстъпка от цената
  15.  
  16.      console.log((total * percentFix).toFixed(3));
  17.  
  18. }
  19.  
  20. chrismas(["4",
  21. "2",
  22. "5",
  23. "13"])
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement