Advertisement
Spocoman

Football Kit

May 29th, 2022
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function footballKit(input) {
  2.     let shirtPrice = Number(input[0]);
  3.     let sum = Number(input[1]);
  4.  
  5.     let shortsPrice = shirtPrice * 0.75;
  6.     let socksPrice = shortsPrice * 0.20;
  7.     let sneakersPrice = (shirtPrice + shortsPrice) * 2;
  8.  
  9.     let price = (shirtPrice + shortsPrice + socksPrice + sneakersPrice) * 0.85;
  10.  
  11.     if (sum > price) {
  12.         console.log("No, he will not earn the world-cup replica ball.");
  13.         console.log(`He needs ${(sum - price).toFixed(2)} lv. more.`);
  14.     } else {
  15.         console.log("Yes, he will earn the world-cup replica ball!");
  16.         console.log(`His sum is ${price.toFixed(2)} lv.`);
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement