using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Class1 c = new Class1();
Console.WriteLine("请先注册1个账户账号以及你的密码");
int a = Convert.ToInt32(Console.ReadLine());
int b = Convert.ToInt32(Console.ReadLine());
c.ID(a);
c.password(b);
Console.WriteLine("请输入你的账号和密码");
int f = Convert.ToInt32(Console.ReadLine());
int d = Convert.ToInt32(Console.ReadLine());
if (c.YanZheng(f, d))
{
Console.WriteLine("请输入1.存款 2.取款 3.查询 4.修改密码");
int g = Convert.ToInt32(Console.ReadLine());
if (g == 1)
{
Console.WriteLine("请输入你要存入的金额");
int h = Convert.ToInt32(Console.ReadLine());
c.Cun(h);
Console.WriteLine("请输入1.存款 2.取款 3.查询 4.修改密码");
g = Convert.ToInt32(Console.ReadLine());
}
if(g == 2){
Console.WriteLine("请输入你要取多少的钱");
int j = Convert.ToInt32(Console.ReadLine());
if (c.Qu(j))
{
Console.WriteLine("存款成功");
Console.WriteLine("请输入1.存款 2.取款 3.查询 4.修改密码");
g = Convert.ToInt32(Console.ReadLine());
}
else
{
Console.WriteLine("存款失败");
Console.WriteLine("请输入1.存款 2.取款 3.查询 4.修改密码");
g = Convert.ToInt32(Console.ReadLine());
}
}
if (g == 3)
{
Console.WriteLine("账号是" + c.NAME1);
Console.WriteLine("余额是" + c.CMoney1);
}
if (g == 4)
{
Console.WriteLine("请输入你的旧密码和新密码");
int u = Convert.ToInt32(Console.ReadLine());
int y = Convert.ToInt32(Console.ReadLine());
c.XiuGaiMM(u, y);
Console.WriteLine("新密码是" + c.NAMEMM1);
Console.WriteLine("请输入1.存款 2.取款 3.查询 4.修改密码");
g = Convert.ToInt32(Console.ReadLine());
}
}
else
{
Console.WriteLine("账户和密码不正确");
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Class1
{
private int CMoney = 0;
public int CMoney1
{
get { return CMoney; }
}
private int QMoney = 0;
private int NAME = 0;
public int NAME1
{
get { return NAME; }
}
private int NAMEMM = 0;
public int NAMEMM1
{
get { return NAMEMM; }
}
public String Cun(int CMoney)
{
this.CMoney = this.CMoney + CMoney;
return "已经存储";
}
public bool Qu(int QMoney)
{
if (this.CMoney > QMoney)
{
this.CMoney = this.CMoney - QMoney;
return true;
}
else
{
return false;
}
}
public void ID(int ID)
{
NAME = ID;
}
public void password(int Password)
{
NAMEMM = Password;
}
public bool YanZheng(int name, int namemima)
{
if (NAME == name && NAMEMM == namemima)
{
return true;
}
else
{
return false;
}
}
public String Search()
{
return "剩余余额 账户ID 账户密码" + this.CMoney + this.NAME + this.NAMEMM;
}
public void XiuGaiMM(int namemm,int newmm)
{
if (NAMEMM == namemm)
{
NAMEMM = namemm;
}
}
}
}