Прописал логику изменения водителя в зависимости от состояния

related #5
parent 6df64f51
......@@ -79,6 +79,21 @@ while (true) {
} else if (parseInt(userAns) == 4) {
console.log('Программа успешно остановлена');
break;
} else if (parseInt(userAns) == 5) {
let truckId: any;
while (true) {
truckId = readlineSync.question('Введите номер грузовика: ');
let isNum: boolean = isNaN(truckId);
if (isNum === false) {
if (parseInt(truckId) > trucks.length || parseInt(truckId) < 1) {
continue;
};
break;
} else {
continue;
};
};
trucks[truckId - 1]._state.changeDriver();
} else {
console.log('Введите корректное значение!');
continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment