How to Use the Elementary C # language to change bank deposits !!!!,

Source: Internet
Author: User

How to Use the Elementary C # language to change bank deposits !!!!,

Are you not satisfied with your current situation?

Do you always lament that your salary is too small?

Do you often find that your items have been reduced, but you still have to sigh?

It doesn't matter! Let me save your wallet!

Next, go to the topic:

To change your bank deposits, you must first find a bank:

class Bank      {             }

After finding the bank, run a card of your own in the bank:

Class Card {private string cardNo; // Card number private string cardOwner; // The private string cardPwd of the cardholder; // The password private double balance; // Balance public double balance {get {return balance;} set {Balance = value ;}} public string CardPwd {get {return cardPwd ;}set {cardPwd = value ;}} public string CardOwner {get {return cardOwner;} set {cardOwner = value ;}} public string CardNo {get {return cardNo ;}set {cardNo = value ;}}}

There are three elements in the card. You must remember it. Remember it. Remember the card number, the card holder, and the password.

After completing the above steps, I will introduce how the bank deposits. The code may be the following:

// Deposit module Console. writeLine ("enter your account"); string cardno = Console. readLine (); for (int I = 0; I <cards. length; I ++) {if (cards [I]! = Null & cards [I]. cardNo = cardno) {flag = true; Console. writeLine ("Enter Password"); string pwd = Console. readLine (); if (cards [I]. cardPwd = pwd) {Console. writeLine ("Congratulations, you have logged on! Enter the deposit amount: "); double GiveMoney = double. parse (Console. readLine (); cards [I]. balance = cards [I]. balance + GiveMoney; Console. writeLine ("Congratulations, your deposit is successful, your current balance is: {0}", cards [I]. balance); break;} else {Console. writeLine ("the password you entered is incorrect! "); Break ;}}}

 

After you know how the system saves the money, you just need to save the money in your card! This is the first way to change deposits! The next step is the second one, but I believe that You don't really want to do this, because You will get fewer and fewer money. That's right, it's just the method to withdraw money.

// Withdrawal module Console. writeLine ("enter your account"); string cardno = Console. readLine (); for (int I = 0; I <cards. length; I ++) {if (cards [I]! = Null & cards [I]. cardNo = cardno) {flag1 = true; Console. writeLine ("Enter Password"); string pwd = Console. readLine (); if (cards [I]. cardPwd = pwd) {Console. writeLine ("Congratulations, you have logged on! Enter the amount you want to withdraw: "); double TakeMoney = double. parse (Console. readLine (); cards [I]. balance = cards [I]. balance-TakeMoney; Console. writeLine ("Congratulations, your deposit is successful, your current balance is: {0}", cards [I]. balance); break;} else {Console. writeLine ("the password you entered is incorrect! "); Break ;}}}

Next is the third and fourth method-that is, you transfer money to your friends and family, or ask your friends to transfer money to you!

// Transfer module Console. writeLine ("enter your account"); string cardno = Console. readLine (); for (int I = 0; I <cards. length; I ++) {if (cards [I]! = Null & cards [I]. cardNo = cardno) {flag2 = true; Console. writeLine ("Enter Password"); string pwd = Console. readLine (); if (cards [I]. cardPwd = pwd & cards [I]. balance! = 0) {if (cards [I]. Balance! = 0) {Console. WriteLine ("Congratulations! Enter the object account you want to transfer: "); string Target = Console. readLine (); for (int j = 0; j <cards. length; j ++) {if (cards [j]. cardNo. equals (Target) | cards [j]. cardNo! = Null) {Console. writeLine ("Enter your operation amount:"); double Transform = double. parse (Console. readLine (); if (Transform <cards [I]. balance & Transform! = 0) {cards [I]. Balance-= Transform; cards [j]. Balance + = Transform; Console. WriteLine ("Congratulations! Your current balance is: {0} ", cards [I]. balance); break;} else {Console. writeLine ("enter the correct operation amount:") ;}} break ;}break;} else {Console. writeLine ("your current balance is insufficient! Transfer is not allowed! ") ;}} Else {Console. WriteLine (" the password you entered is incorrect! "); Break ;}}return flag2 ;}

All the methods have been completed. You don't have to thank me. By the way, my name is: "Leibo". By the way, the method for changing deposits is the code in the bank class. Don't tell others!
Finally, I will give you my favorite famous saying: Do it yourself and enjoy yourself.

Related Article

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.