ATM

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;
            }
        }
    }
}


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值