Advertisement
Spocoman

Final Competition

May 28th, 2022 (edited)
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function finalCompetition(input) {
  2.     let dancers = Number(input[0]);
  3.     let points = Number(input[1]);
  4.     let season = input[2];
  5.     let destination = input[3];
  6.  
  7.     let totalSum = dancers * points;
  8.  
  9.     if (destination === "Abroad") {
  10.         totalSum *= 1.5;
  11.         if (season === "summer") {
  12.             totalSum *= 0.9;
  13.         } else {
  14.             totalSum *= 0.85;
  15.         }
  16.     } else {
  17.         if (season === "summer") {
  18.             totalSum *= 0.95;
  19.         } else {
  20.             totalSum *= 0.92;
  21.         }
  22.     }
  23.  
  24.     console.log(`Charity - ${(totalSum * 0.75).toFixed(2)}`);
  25.     console.log(`Money per dancer - ${(totalSum * 0.25 / dancers).toFixed(2)}`);
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement