Advertisement
Liliana797979

market toys

Nov 29th, 2020
464
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function marketToys (arg1, arg2, arg3, arg4, arg5, arg6) {
  2.     let excursionPrice = Number(arg1);
  3.     let puzzlesCount = Number(arg2);
  4.     let dollsCount = Number(arg3);
  5.     let teddyBears = Number(arg4);
  6.     let minionsCount = Number(arg5);
  7.     let trucksCount = Number(arg6);
  8.     let toys = 0;
  9.  
  10.     if (toys >= 50) {
  11.         let discount = 0.25 * totalSum;
  12.     }
  13.  
  14.     let totalSum = puzzlesCount * 2.60 + teddyBears * 4.10 + minionsCount * 8.20 + trucksCount * 2;
  15.     let toysCount = puzzlesCount + teddyBears + minionsCount + trucksCount;
  16.     let totalPrice = totalSum - (totalSum * discount);
  17.     let rent = 0.10 * totalPrice;
  18.     totalProfit = totalPrice - rent;
  19.     totalMoney = totalProfit - excursionPrice;
  20.  
  21.  
  22.     if (money == "enough") {
  23.         console.log(`Yes! ${totalMoney - totalProfit} lv left.`);
  24.     } else {
  25.         console.log(`Not enough money! ${totalProfit - totalMoney} lv needed.`);
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement