Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
829 B
0
Indexable
Never
function finalcompetition (input) {
    let dancers = Number(input[0]);
    let points = Number(input[1]);
    let season = input[2];
    let place = input[3];

    let totalMoney = 0;

    if (place === "Bulgaria") {
        totalMoney = points * dancers;
    } else if (place === "Abroad") {
        totalMoney = (points * dancers) + 0.5 * (points * dancers);
    }

    let expense = 0;
    if (season === "summer") {
        expense = 0.1;
    } else if (season === "winter") {
        expense= 0.08;
    }

    let expenses = totalMoney * expense;
    totalMoney -= expenses;

    let charity = totalMoney * 0.75;
    let moneyPerDancer = (totalMoney - charity) / dancers;

    console.log(`Charity - ${charity.toFixed(2)}`);
    console.log(`Money per dancer - ${moneyPerDancer.toFixed(2)}`);
}
Leave a Comment