Const ReadLine = require (' Readline-sync ')//reference Readline-sync
Let S = number of 2;//errors
for (Let i = 0; i < 3; i++) {
Console.log (' Please enter the name: (composed of English) ');
Let user = Readline.question ();
Console.log (' Please enter password: (composed of numbers) ');
Let password = readline.question ();
Let arr = [' Yang ', ' 123456 '];
if (user = = Arr[0] && Password = = arr[1]) {
Console.log (' Welcome, landing success ');
for (Let Yewu = 1; yewu >= 1; yewu++) {
Console.log (' Please select business: \n1. Deposit: \n2. Withdrawals: \n3. View: \n4. Exit: ');
Let Yewu = readline.question ()-0;
Let money = 3000;
if (Yewu > 4) {
Console.log (' Sorry you entered the wrong, please re-enter: ')
Continue
}
Switch (YEWU) {
Case 1:
Deposit Money2 for the total amount of money after change
Console.log (' deposit ');
Console.log (' Please enter deposit amount: ');
Let Cunkuan = readline.question ()-0;
Money2 = money + Cunkuan;
Console.log (' system is saving for you, please wait ... \ nto save your current balance as ' + money2 ';
Continue
Case 2:
Console.log (' withdrawals ');
Console.log (' Please enter the withdrawal amount: ');
Let Qukuan = readline.question ()-0;
if (Qukuan > Money2) {
Console.log (' Sorry for your lack of balance! , your balance is insufficient, please re-enter or exit ');
} else {
Money2 = Money2-qukuan;
Console.log (' Current balance: ' + money2);
}
Continue
Case 3:
Console.log (' view ');
Console.log (' Your current balance is: ' + Money2 ');
Continue
Case 4:
Console.log (' exit ');
Console.log (' Welcome to your next use! ‘);
Break
}break;
}
Break
} else {//input is incorrect
if (s! = 0) {
Console.log (' Password or account name error, you also have ' + S + ' chance, please re-enter: ");
s--;
Continue
} else {
Console.log (' Sorry, the account is locked! ‘);
Break
}
}
}
Write a bank to save money in Java