// a

function a() {
    alert('Привет');
}

// cube 

function cube(number) {
    number = number ** 3;
    return number;
}

// avg2

function avg2(a = 0, b = 0) {
    let avg = (a + b) / 2;
    return avg;
};

// sum3

function sum3(a = 0, b = 0, c = 0) {
    let sum = (a + b + c);
    return sum;
}

// intRandom

function intRandom(a = 0, b = 0) {
    let randomNumber = Math.random() * (b - a) + a;

    return Math.round(randomNumber);
};

// greetAll

function greetAll() {
    for (let i = 0; i < arguments.length; i++) {
        alert("Hello, " + arguments[i]);
    };
};

// sum

function sum() {
    let result = 0;

    for (let i = 0; i < arguments.length; i++) {
        result += arguments[i];
    }

    return result;
}

// Union

function aSample() {
    return a("Привет!");
}

function cubeSample() {
    return cube(5);
}

function avg2Sample() {
    return avg2(10, 5);
}

function sum3Sample() {
    return sum3(2, 4, 6);
}

function intRandomSample() {
    return intRandom(0, 1);
}

function greetAllSample() {
    return greetAll("Superman", "SpiderMan", "Captain Obvious");
}

function sumSample() {
    return sum(10, 20, 40, 100);
}

var taskName = prompt("Введите название задания");
switch (taskName.toLowerCase()) {
    case "a":
        aSample();
        break;
    case "cube":
        cubeSample();
        break;
    case "avg2":
        avg2Sample();
        break;
    case "sum3":
        sum3Sample();
        break;
    case "intRandom":
        intRandomSample();
        break;
    case "greetAll":
        greetAllSample();
        break;
    case "sum":
        sumSample();
        break;
}


// Union declarative

let unionDeclarative = {
    a: aSample(),
    cube: cubeSample(),
    avg2: avg2Sample(),
    sum3: sum3Sample(),
    intRandom: intRandomSample(),
    greetAll: greetAllSample(),
    sum: sumSample()
}   