Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function finalCompetition(input) {
- let dancers = Number(input[0]);
- let points = Number(input[1]);
- let season = input[2];
- let destination = input[3];
- let totalSum = dancers * points;
- if (destination === "Abroad") {
- totalSum *= 1.5;
- if (season === "summer") {
- totalSum *= 0.9;
- } else {
- totalSum *= 0.85;
- }
- } else {
- if (season === "summer") {
- totalSum *= 0.95;
- } else {
- totalSum *= 0.92;
- }
- }
- console.log(`Charity - ${(totalSum * 0.75).toFixed(2)}`);
- console.log(`Money per dancer - ${(totalSum * 0.25 / dancers).toFixed(2)}`);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement