C # immerse yourself in the banking system of. WO in the code,

Source: Internet
Author: User

C # immerse yourself in the banking system of. WO in the code,

Kindergarten taipan, Mo

Today, I will share with you the Money banking system code that everyone loves. It's not a dream to save Money and make you the richest man!

So let's take a look at what makes me the dumb and ugly, and instantly becomes the richest man (Keke! Installation is a little big)

1 // to succeed, you must Ma to 2 // create an array 3 Card [] cards = new Card [21]; 4 // The Card class initializes 5 public void InitialData () 6 7 {8 // 1. prepare a Card object Card card1 = new card (); 9 Card. cardNo = "212121"; card1.CardOwner = ""; 10 card1.CardPwd = "666666"; 8 card1.Balance = 7.20..2.16.474.741;

The above is my bank card information for free! Don't be vague. Ask me for my phone number: holes, holes, and holes.
Next we will continue to teach you how to create your own bank card (account opening) another series of operations that teach you how to use my card to get money, save money, and so on. If you have a lot of money, RMB players can also save money in my bank card. Everyone is welcome to participate.

 

Open an account first

 

Console. writeLine ("Enter the card number:"); string cardNo = Console. readLine (); Console. writeLine ("Enter Password:"); string cardPwd = Console. readLine (); Console. writeLine ("Enter the User name:"); string cardOwner = Console. readLine (); Console. writeLine ("Enter the account opening amount:"); double balance = double. parse (Console. readLine (); // first assemble scattered attributes into a card object
Card card = new Card (); card. CardNo = cardNo;
Card. CardPwd = cardPwd;
Card. CardOwner = cardOwner; card. Balance = balance;
// 01. assign the card object to the first null item of the array for (int I = 0; I <cards. length; I ++) {if (cards [I] = null ){
// I will assign the card value to cards [I] cards [I] = card; Console. WriteLine ("account opened successfully ");
Break;
}
}
Console. WriteLine ("=========================="); Welcome ();
}
// An item is a card
If (item! = Null) {Console. WriteLine ("username {0} \ t Balance {1}", item. CardOwner, item. Balance );}

 

After learning to open an account, we will learn how to save money (deposit)

 

 

 

Console. WriteLine ("Enter the card number :");
String cardno = Console. ReadLine (); bool flag = false;
// How to determine whether the other Card number has a foreach (Card item in cards)
{
If (item! = Null ){
If (item. CardNo. Equals (cardno) // The card number exists {
// Enter the amount Console. WriteLine ("Enter the deposit amount:"); int money = int. Parse (Console. ReadLine ());
Item. Balance + = money; Console. WriteLine ("deposit successful ");
Console. WriteLine ("Balance: {0}", item. Balance );
Flag = true; break ;}

Well, we learned to save it. The next step is to save it. If it doesn't get it, it's sad.

Bool flag = false; // The Card's foreach (Card item in cards) {if (item! = Null) {if (item. CardNo. Equals (account ))
// Prove that the card exists {// prompt the user to enter the password Console. writeLine ("Enter Password:"); string pwd = Console. readLine (); if (item. cardPwd. equals (pwd) {// The code is executed here to prove that the user name and password are correct. Console. writeLine ("Enter the withdrawal amount:"); int money = int. parse (Console. readLine (); if (money <item. balance) {item. balance = item. balance-money; Console. writeLine ("withdrawal successful, account balance of username {0} is {1}", item. cardOwner, item. balance);} else {Console. writeLine ("insufficient balance ");}}

Well, we will get the money. Then we will learn to transfer the money (transfer money)

YOU are so rich and kind, right? Like my Lei brother.

From time to time, I want to turn some life-saving money to the poor and scum-stricken people, right? So I want to learn from him and continue learning from him.

 

 

 

Else {bool outCardFlag = false; // The default incoming Card does not exist int type = 0; foreach (card in cards) {if (Card! = Null) {if (card. cardNo. equals (outCardNo) // the same card number {flag = true; // determine whether the password is consistent if (card. cardPwd. equals (outCardPwd) // The password is consistent {// the username and password are correct. Continue with the following content.
Console. WriteLine ("Enter the transfer card number:"); string inCardNo = Console. ReadLine ();
# Region inner layer loop, transfer card
Foreach (Card card1 in cards) {if (card1! = Null)
{If (card1.CardNo. Equals (inCardNo) // The transfer card exists.
{
Type = 1; // Yes, prompting you to enter the transfer amount
Console. WriteLine ("Enter the transfer amount :");
Int money = Convert. ToInt32 (Console. ReadLine ());
If (money <= card. Balance) // valid {while (money % 100! = 0) // The value is not 100 yuan
{
Console. WriteLine ("the value you entered is incorrect. Please try again ");
Money = Convert. ToInt32 (Console. ReadLine ());}

 

 

Hahaha, I have learned everything now. I believe you will certainly be playing more and more 6 through hard work.

Play around the whole banking system, the number of richest people behind the number of 0 to eye cramps.

                  

The above is what students in this "kindergarten class" know.

I also hope you can give me more advice on this trip.

Thank you!

Please wait for the next decomposition.

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.