const workingHours = 8; // Number of working hours a day
// let workingDays = +prompt("Enter working days number ", ""); // Number of working days in a month
let workingDays = checkNan("Enter working days number");
let checkPrompt = isFinite(workingDays);

function checkNan(title) {
    const workingDays = +prompt(title, ""); // Number of working days in a month
    return workingDays;
}

while (isNaN(workingDays) === true ) {
    alert("Working days should be a number");
    workingDays = checkNan("Enter working days number");
}

let totalHoursInMonth = workingHours * workingDays;
alert(`Your Total hours this month = ${totalHoursInMonth}`);

let sallary = checkNan("Enter sallary you've got this month"); // Sallary for month
while (isNaN(sallary) === true ) {
    alert("Sallary should be a number");
    sallary = checkNan("Enter working days number");
}

let rate = sallary / totalHoursInMonth; // Rate per hour
alert(`Your rate this month was ${rate}`);


// -----------------------------------------BLUE TASK---------------------------------------
let login = prompt('Enter login', 'default');
if (login == 'admin') {
    let password = prompt('Password', 'Enter password');
    if (password == 'qwerty') {
        alert('Hello Admin', "background: green;");  // I used console.log when I started to write this code. So background doesn't work with alert
    } else if (password == '' || password == null) {
        alert('Wrong password');
    } else {
        alert('Cancelled');
    }
} else if (login == null || login == '') {
    alert('Cancelled');
} else {
    alert("Login is wrong", "background: red;");
}