Java-initial implementation of banking

Source: Internet
Author: User
User class: // 1. Compile a program that simulates the user account. Test is used to log on: Enter the user account name and password. If the password is correct (output success in the console, // and prompt whether to change the user name and password. Modify the password: in the displayed dialog box, enter the account name and password again. If you do not change the password, the next logon dialog box is displayed .) // If the account name is incorrect or the password is incorrect? The system prompts you to re-enter the file. A maximum of three times are allowed. Otherwise, you can output the Fail file on the console and exit the program: system. exit (0) // public class passer {string username = "ASD"; string Password = "fgh"; int balance = 10000; Public String GetUserName () {return username ;} public String setusername (string h) {username = H; return username;} Public String GetPassword () {return password;} public void setpassword () {This. password = password;} public void play () {system. out. println ("your account is" + username); system. out. println ("Your password is" + password); system. out. println ("your deposit is" + balance );
Test class import Java. util. *; public class test {// test class test is used to log on: Enter the user account name and password. If it is correct (output success on the console, // and prompt whether to change the user name and password, to modify: Enter the account name and password again in the pop-up box. If you do not change the password, the next logon dialog box is displayed .) // If the account name is incorrect or the password is incorrect? The system prompts you to re-enter the file. A maximum of three times are allowed. Otherwise, you can output the Fail file on the console and exit the program: system. exit (0)/*** @ Param ARGs */public static void main (string [] ARGs) {// todo auto-generated method stubpasser P = new passer (); system. out. println ("enter your account and password"); For (INT I = 0; I <3; I ++) {Role A = new role (system. in); partition B = new partition (system. in); string num1 =. next (); string num2 = B. next (); Boolean T = P. username. equals (num1); Boolean L = P. password. equals (num2); If (T & l = true) {system. out. println ("success, input successful"); system. out. println ("do you want to change the password and account? Press 1. If not, press 2."); then f = New Login (system. in); int num3 = f. nextint (); If (num3 = 1) {system. out. println ("Change your account and password"); US = new users (system. in); string num4 = us. next (); p. setusername (num4); signature Pa = new signature (system. in); string num5 = pa. next (); p. setusername (num5); system. out. println ("the modified data is shown as follows"); p. play ();} else {P. play () ;}} else if (t = false) system. out. println ("the account you entered is incorrect. Please re-enter the account and password"); else system. out. println ("the password you entered is incorrect. Please enter the account and password again");} system. out. println ("fail"); system. exit (0 );}}

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.