class Task {
constructor(document_number) { this.document_number = document_number; }
getOperations() {
// Шаг №1
console.log("Your input: " + this.document_number);
// Шаг №2
if (this.document_number % 2 == 0) {
let operation_1 = "+";
console.log("Operation №1: " + operation_1);
} else if (this.document_number % 2 == 1) {
let operation_1 = "-";
console.log("Operation №1: " + operation_1);
};
// Шаг №3
const c = this.document_number % 3;
console.log("Const C: " + c);
// Шаг №4
if (this.document_number % 5 == 0) {
let operation_2 = "*";
console.log("Operation №2: " + operation_2);
} else if (this.document_number % 5 == 1) {
let operation_2 = "/";
console.log("Operation №2: " + operation_2);
} else if (this.document_number % 5 == 2) {
let operation_2 = "%";
console.log("Operation №2: " + operation_2);
} else if (this.document_number % 5 == 3) {
let operation_2 = "+";
console.log("Operation №2: " + operation_2);
} else if (this.document_number % 5 == 4) {
let operation_2 = "-";
console.log("Operation №2: " + operation_2);
}
// Шаг №5
if (this.document_number % 7 == 0) {
let i_j_index = "byte";
console.log("I/J index: " + i_j_index);
} else if (this.document_number % 7 == 1) {
let i_j_index = "short";
console.log("I/J index: " + i_j_index);
} else if (this.document_number % 7 == 2) {
let i_j_index = "int";
console.log("I/J index: " + i_j_index);
} else if (this.document_number % 7 == 3) {
let i_j_index = "long";
console.log("I/J index: " + i_j_index);
} else if (this.document_number % 7 == 4) {
let i_j_index = "char";
console.log("I/J index: " + i_j_index);
} else if (this.document_number % 7 == 5) {
let i_j_index = "float";
console.log("I/J index: " + i_j_index);
} else if (this.document_number % 7 == 6) {
let i_j_index = "double";
console.log("I/J index: " + i_j_index);
}
}
calculate() {
console.log("ТУТ ДОЛЖНЫ БЫТЬ ПЕРЕМЕННЫЕ ИЗ МЕТОДА getOperations()");
}
}
task = new Task(1418);
task.getOperations();
task.calculate();
Вот собственно.