用C#编写的银行取款系统
2010-05-14 14:51
411 查看
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Inten
{
class Data
{
st S = new st();
int x = 0;
public void hello()
{
Console.WriteLine("**********************************");
Console.WriteLine("**********************************");
Console.WriteLine("*****欢迎使用工商银行存取款机*****");
Console.WriteLine("**********************************");
Console.WriteLine("**********************************");
Username();
}
private void Username()
{
S.Username=new string[3];
S.Username[0] = "zhang";
S.Username[1] = "yi";
S.Username[2] = "gang";
Userpwd();
}
private void Userpwd()
{
S.Userpwd = new string[3];
S.Userpwd[0] = "ZH";
S.Userpwd[1] = "YI";
S.Userpwd[2] = "GA";
Usermoney();
}
private void Usermoney()
{
S.Usermoney = new double[3];
S.Usermoney[0] = 5000;
S.Usermoney[1] = 3000;
S.Usermoney[2] = 1000;
check();
}
//选择进出
private void Land()
{
Console.WriteLine("你确定要退出吗?");
Console.WriteLine("1.是 2.否");
int xn;
xn = Convert.ToInt32(Console.ReadLine());
switch (xn)
{
case 1:
Console.WriteLine("谢谢您光临工商银行存取款机!");
break;
case 2:
QJD();
break;
}
}
//登陆进入
private void check()
{
bool bo = false;
for(int y=0;y<3;y++)
{
Console.WriteLine("请输入用户名:");
string name = Console.ReadLine();
Console.WriteLine("请输入密码:");
string pwd = Console.ReadLine();
for (; x < S.Username.Length; x++)
{
if (name.Equals(S.Username[x]) && pwd.Equals(S.Userpwd[x]))
{
bo = true;
S.Id = x;
break;
}
}
if (bo)
{
Console.WriteLine("登陆成功!");
//执行应用程序
QJD();
break;
}
else
{
Console.WriteLine("请正确输入!");
}
}
}
private void QJD()
{
while (true)
{
bool bo = false;
Console.WriteLine("**********************************");
Console.WriteLine("*****欢迎使用工商银行存取款机*****");
Console.WriteLine("**********************************");
Console.WriteLine("1.取款 2.存款");
Console.WriteLine("3.转账 4.查询");
Console.WriteLine(" 5.退卡");
int n;
n = Convert.ToInt32(Console.ReadLine());
switch (n)
{
case 1:
//取款
qk();
break;
case 2:
//存款
ck();
break;
case 3:
//转账
zz();
break;
case 4:
//查询
chaxu();
break;
case 5:
//退卡???
Console.WriteLine("谢谢您的光临!");
bo = true;
break;
Land();
}
if (bo)
{
break;
}
else
{
continue;
}
}
}
//1.取款
private void qk()
{
Console.WriteLine("请输入你要取款的金额:");
double nx = Convert.ToDouble(Console.ReadLine());
if (nx > S.Usermoney[S.Id])
{
Console.WriteLine("你的余额不足!");
QJD();
}
S.Usermoney[S.Id] = S.Usermoney[S.Id] - nx;
}
//2.存款
private void ck()
{
Console.WriteLine("请输入你要存款的金额:");
double nx = Convert.ToDouble(Console.ReadLine());
S.Usermoney[S.Id] = S.Usermoney[S.Id] + nx;
}
//3.转账
private void zz()
{
//Console.WriteLine("请输入你要转账的账号:");
//string name = Console.ReadLine();
//if (name.Equals(S.Username))
//{
// Console.WriteLine("请输入你要转账的金额:");
// double num = Convert.ToDouble(Console.ReadLine());
// if (num > S.Usermoney[S.Id])
// {
// Console.WriteLine("您的余额不足!");
// QJD();
// }
// else
// {
// S.Usermoney[S.Id] = S.Usermoney[S.Id] - num;
// S.Usermoney[name] = S.Usermoney[name] + num;
// }
//}
}
//4.查询
private void chaxu()
{
Console.WriteLine("你的余额:"+S.Usermoney[S.Id]);
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Inten
{
class Data
{
st S = new st();
int x = 0;
public void hello()
{
Console.WriteLine("**********************************");
Console.WriteLine("**********************************");
Console.WriteLine("*****欢迎使用工商银行存取款机*****");
Console.WriteLine("**********************************");
Console.WriteLine("**********************************");
Username();
}
private void Username()
{
S.Username=new string[3];
S.Username[0] = "zhang";
S.Username[1] = "yi";
S.Username[2] = "gang";
Userpwd();
}
private void Userpwd()
{
S.Userpwd = new string[3];
S.Userpwd[0] = "ZH";
S.Userpwd[1] = "YI";
S.Userpwd[2] = "GA";
Usermoney();
}
private void Usermoney()
{
S.Usermoney = new double[3];
S.Usermoney[0] = 5000;
S.Usermoney[1] = 3000;
S.Usermoney[2] = 1000;
check();
}
//选择进出
private void Land()
{
Console.WriteLine("你确定要退出吗?");
Console.WriteLine("1.是 2.否");
int xn;
xn = Convert.ToInt32(Console.ReadLine());
switch (xn)
{
case 1:
Console.WriteLine("谢谢您光临工商银行存取款机!");
break;
case 2:
QJD();
break;
}
}
//登陆进入
private void check()
{
bool bo = false;
for(int y=0;y<3;y++)
{
Console.WriteLine("请输入用户名:");
string name = Console.ReadLine();
Console.WriteLine("请输入密码:");
string pwd = Console.ReadLine();
for (; x < S.Username.Length; x++)
{
if (name.Equals(S.Username[x]) && pwd.Equals(S.Userpwd[x]))
{
bo = true;
S.Id = x;
break;
}
}
if (bo)
{
Console.WriteLine("登陆成功!");
//执行应用程序
QJD();
break;
}
else
{
Console.WriteLine("请正确输入!");
}
}
}
private void QJD()
{
while (true)
{
bool bo = false;
Console.WriteLine("**********************************");
Console.WriteLine("*****欢迎使用工商银行存取款机*****");
Console.WriteLine("**********************************");
Console.WriteLine("1.取款 2.存款");
Console.WriteLine("3.转账 4.查询");
Console.WriteLine(" 5.退卡");
int n;
n = Convert.ToInt32(Console.ReadLine());
switch (n)
{
case 1:
//取款
qk();
break;
case 2:
//存款
ck();
break;
case 3:
//转账
zz();
break;
case 4:
//查询
chaxu();
break;
case 5:
//退卡???
Console.WriteLine("谢谢您的光临!");
bo = true;
break;
Land();
}
if (bo)
{
break;
}
else
{
continue;
}
}
}
//1.取款
private void qk()
{
Console.WriteLine("请输入你要取款的金额:");
double nx = Convert.ToDouble(Console.ReadLine());
if (nx > S.Usermoney[S.Id])
{
Console.WriteLine("你的余额不足!");
QJD();
}
S.Usermoney[S.Id] = S.Usermoney[S.Id] - nx;
}
//2.存款
private void ck()
{
Console.WriteLine("请输入你要存款的金额:");
double nx = Convert.ToDouble(Console.ReadLine());
S.Usermoney[S.Id] = S.Usermoney[S.Id] + nx;
}
//3.转账
private void zz()
{
//Console.WriteLine("请输入你要转账的账号:");
//string name = Console.ReadLine();
//if (name.Equals(S.Username))
//{
// Console.WriteLine("请输入你要转账的金额:");
// double num = Convert.ToDouble(Console.ReadLine());
// if (num > S.Usermoney[S.Id])
// {
// Console.WriteLine("您的余额不足!");
// QJD();
// }
// else
// {
// S.Usermoney[S.Id] = S.Usermoney[S.Id] - num;
// S.Usermoney[name] = S.Usermoney[name] + num;
// }
//}
}
//4.查询
private void chaxu()
{
Console.WriteLine("你的余额:"+S.Usermoney[S.Id]);
}
}
}
相关文章推荐
- 银行管理系统 实现用户注册 登录 存、取款 交易记录查询和修改用户信息等功能
- C#编写功能让你的系统导入注册表文件时不提示
- 控制台应用程序模拟银行取款(C#)
- Java设计的银行取款系统-Mysql数据库(改进篇)2017/7/16
- 编写银行转账系统的数据库
- C#银行系统
- 2-2 为方便储户,某银行拟开发计算机储蓄系统。储户填写的存款单或取款单由业务员键入系统,如果是存款,系统记录存款人姓名、住址、存款类型、存款日期、利率等信息,并印出存款单给储户;如果是取款,系统计算利息并印出利息清单给储户。请写出问题定义并分析此系统的可行性。
- C语言编写的银行管理系统关键代码
- 2.为方便储户,某银行拟开发计算机储蓄系统。储户填写的存款单或取款单由业务员输入系统,如果是存款,系统纪录存款人姓名、住址、存款类型、存款日期、利率等信息,并打印出存款单给储户;如果是取款,系统计算利息并打印利息清单给储户。
- 服务程序C#编写系统服务,注册表读写问题
- asp.net 对系统服务的控制和c#编写系统服务
- C#编写NotifyIcon 系统托盘
- 用visual stdio C#编写的程序能移植到wince的系统中吗?
- 初学C#--一个简单的银行系统模拟
- c#编写的基于Socket的异步通信系统
- 服务程序C#编写系统服务,注册表读写问题
- 用C#把批处理文件改为windows系统服务(简单的C#编写系统服务教程)
- 用C#代码编写一个登陆系统
- c#编写的基于Socket的异步通信系统--SanNiuSignal.DLL已开源
- c++编写银行管理系统