光阴似箭,岁月如梭。

从开始学Java到现在学C#已快四个月了,我们学的东西越来越多了。但是虽说学到现在,都不知道有什么用?没地方表现啊。

那么今天我就来给大家说说说这些东西的用处吧。

就拿MyBank系统来讲解吧,望大家好好看将会得到不少的收获哦。

那么这个MyBank系统我们应该怎样来写呢?请看看下面的详细解答。

首先先看一些部分功能的效果图

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAn0AAAGFCAIAAAAHONJzAAAgAElEQVR4nO2dS5IFTXKVcxGsgAE7YAUsgHVoqClDLYGhGICZ1iAD/kZNghACBHp0t9QPtRAPITUSCJBgzqB+u50V7n7iRGTeyFtV32dlZXk9Pdw9IiPjVNxXbb/623/GDz/88MMPPy/18yvffP8Xf+mXf+Hv/f1rf37xl375V775/rIU/+Af/urf/Vt/++/8jb95/Nn+8e/8jB9++OGHH374WfOz/ZPf/e/88MMPP/zww8+an+2f/t6f88MPP/zwww8/a36+1d1/BAAAAM/n57r7CwAAAPBk3unuBgAAAE8F3QUAAFgHugsAALAOdBcAAGAd6C4AAMA60F0AAIB1oLsAAADraHR3D7y5Yf9YdgAAeFHY7wIAAKyD/e6ntAMAwIvCfhcAAGAd6C4AAMA60F0AAIB1oLsAAADrQHcBAADWge4CAACsA909z7M/vXP81NCFZRz9RyObufwUF6KrdfqSljrR5Wf4O60mYi64OtMpup+Um56fAPeA7p7nWtES/t3VxF9u4ueARfPpLpi6Gz+FXC2ypo+26IdVqc7gpyXpjuuYcw2bYdfD1TTpjnA8NZqi2zUnWjfy9NgCPB1016daEbp3eLOoxWiVf2zuFKnPVotp1XxiUUujiSaVm1PMhKWbbj/8FRIvunkRRT3a3vikKXS6o7/o+1AlqfNQCjGM3UQTbkOdAlgKujtNuvimq8n+fkEXxm7kJ61WVTFV6jP91cXoJk4up5Wu5PjbDOJ3YRvZ3zvp9KluL/yk0d8cKD1Julm0f1PPyYEFWAG6O0266KSW9JTQiaqVs3yYS4wpKqmbv5R3FehxylwunVzHgyZUN9HRTZSX1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qLcT6rcUAAADwjvh/AN/s1fHxYWUHAACAnOp5Zq3B6eeF0F0AAIAOQ7rbPKVc2QEAACCn+p7I6onlLXueOX3aGQAAAFr8/W53m4vuAgAAdBjS3eZUZQcAAIAc3s8MAACwDj6/CwAAsA6+rwoAAGAd6C4AAMAy/j8hcOv329o32gAAAABJRU5ErkJggg==" alt="" />

现在关键时刻到啦,那就是怎么写呢?请看看下面代码及方法。

步骤:

1.首先要创一个数组:代码如下:

Card[] cards = new Card[];

2:初始化卡类:

public void InitialData()

{ //01.准备一个卡对象 Card card1=new Card();

card1.CardNo = "025"; card1.CardOwner = "小英";

card1.CardPwd = "100"; 8 card1.Balance = 0.0;

//02.将卡对象赋值给数组第一项  cards[0] = card1; //创建第2个卡对象

Card card2=new Card();  card2.CardNo = "205";  card2.CardOwner = "小颖";

card2.CardPwd = "200";  card2.Balance = 500000000; cards[1] = card2;

3.开户

Console.WriteLine("请输入卡号:");

string cardNo = Console.ReadLine();

Console.WriteLine("请输入密码:");

string cardPwd = Console.ReadLine();

Console.WriteLine("请输入用户名:");

string cardOwner = Console.ReadLine();

Console.WriteLine("请输入开户金额:");

double balance = double.Parse(Console.ReadLine());

//先将四个零散的属性装配成一个Card对象 Card card=new Card();

card.CardNo = cardNo;  card.CardPwd = cardPwd;  card.CardOwner = cardOwner;

card.Balance = balance;  //01.将card对象赋值给数组第一个为null的项目

for (int i = 0; i < cards.Length; i++) {  if (cards[i]==null)

{ //我就将card赋值给cards[i]  cards[i] = card;

Console.WriteLine("开户成功");  break;  } } Console.WriteLine("===================");

Welcome();  }  //输出所有账户的持卡人,以及余额  public void PrintCustomerInfo()  {  foreach (Card item in cards) {

//一个item就是一张卡  if (item!=null)  {

Console.WriteLine("用户名{0}\t余额{1}", item.CardOwner, item.Balance);

}

4.存款

Console.WriteLine("请输入卡号:"); string cardno = Console.ReadLine();

bool flag = false; //如何判断对方卡号存在

foreach (Card item in cards) { if (item!=null)

{ if (item.CardNo.Equals(cardno))//卡号存在

{ //请输入金额 Console.WriteLine("请输入存款金额:");

int money = int.Parse(Console.ReadLine()); item.Balance += money;

Console.WriteLine("存款成功"); Console.WriteLine("余额:{0}",item.Balance); flag = true; break;

}

5.取款

bool flag = false;//默认没有该卡
foreach (Card item in cards)
{
if (item!=null)
{
if (item.CardNo.Equals(account))//证明卡存在 003 001
{
//提示用户输入密码
Console.WriteLine("请输入密码:");
string pwd = Console.ReadLine();
if (item.CardPwd.Equals(pwd))
{
//代码执行到这里,证明用户名和密码均正确
Console.WriteLine("请输入取款金额:");
int money = int.Parse(Console.ReadLine());
if (money < item.Balance)
{
item.Balance = item.Balance - money;
Console.WriteLine("取款成功,用户名是{0}的账户余额是{1}", item.CardOwner, item.Balance);
}
else {
Console.WriteLine("余额不足");
}
}
else
{

6.转账

 bool outCardFlag = false;//默认转入卡不存在
int type = 0;
foreach (Card card in cards)
{
if (card!=null)
{
if (card.CardNo.Equals(outCardNo)) //卡号一致
{
flag = true;
//判定密码是否一致
if (card.CardPwd.Equals(outCardPwd)) //密码一致
{
//用户名 密码均正确,可以执行后续内容
Console.WriteLine("请输入转入卡卡号");
string inCardNo = Console.ReadLine();
#region 内层循环,转入卡
foreach (Card card1 in cards)
{
if (card1 != null)
{
if (card1.CardNo.Equals(inCardNo)) //转入卡存在
{
type = 1;
//存在,可以提示输入转账金额
Console.WriteLine("请输入转账金额");
int money = Convert.ToInt32(Console.ReadLine());
if (money <= card.Balance) //合法
{
while (money % 100 != 0) //不是面值100的
{
Console.WriteLine("您输入的不合法");
money = Convert.ToInt32(Console.ReadLine());
}

这上面几个步骤就是写这个MyBank系统的关键。大家都得了什么收获?

本人能力有限,如果有不足之处,望大家给个建议哦,在这就先谢谢大家了。

05-11 13:30