Write a bank to save money in Java

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.