// ------------------Number: age  task----------------------------------

let userAge = +prompt("Enter your age", "");
let userYearOfBirth = 2020 - userAge;
alert(userYearOfBirth);

// ------------------Number: temperature --------------------------------

let temperatureCelsius = +prompt("Enter number degrees Celsius", "");
let celsiusToFahrenheit = x => x * 1.8 + 32;
alert(celsiusToFahrenheit(temperatureCelsius));

// ------------------Number: divide ----------------------------------

let num1 = +prompt("Enter number1");
let num2 = +prompt("Enter number2");

function divideNum(x, y) {
    const divN = x / y;
    return Math.round(divN);
}

alert(divideNum(num1, num2)); 

// ------------------Number: odd ----------------------------------

// debugger
let enterNum = +prompt("Enter number");
if (enterNum == typeof(Number)) {
    if (enterNum % 2 === 0) {
        alert("Even number");
    } else {
        alert("Odd number");
    }
} else {
    alert("You need to enter number");    //  NEED TO FIX
}

// ------------------Number: greeting ----------------------------------

let name = prompt("Enter your name", "");
alert(`Hello ${name}! How are you?`);

// ------------------Number: lexics ------------------------------------

let someText = prompt("Enter some text");
if (someText.includes("PHP")) {
    alert("You've got $ only in variables");
} else {
    alert("You are not PHP developer");
}

// ------------------Number: lexics ------------------------------------

let checkSex = confirm("Are you a man?");
if (checkSex === true) {
    alert("Sex - male");
} else {
    alert("Sex - feemale");
}

// ------------------Array: real ------------------------------------

let racers = [
    {
        name: "Valentino",
        surname: "Rossi",
        number: 46,
        team: "Yamaha"
    },
    {
        name: "Andrea",
        surname: "Dovisioso",
        number: 04,
        team: "Ducati"
    },
]

// ------------------Number: flats ------------------------------------

let flatNumber = +prompt("Enter number of flat in house");
let maxFloorNumber = +prompt("Enter number of floors in house");
let flatsPerFloor = +prompt("Enter total flats number in house");
let entrance;
let floor;

    entrance = Math.trunc((flatNumber - 1) / (maxFloorNumber * flatsPerFloor)) + 1;
    floor = Math.trunc(((flatNumber - 1) % (maxFloorNumber * flatsPerFloor)) / flatsPerFloor) + 1;

alert(`Floor: ${floor}, entrance: ${entrance}`);