⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bankcard.java.java

📁 银行查询服务
💻 JAVA
字号:
//银行服务系统
public class Bank {
	
	public String name;
	public String IdCard;
	public String Card;
	public double AllMoney;
	public double Money;//当前余额
	private int MiMa;
	
	public Bank(String name,String IdCard,String Card,double Money ,int MiMa) {
		this.name = name;
		this.IdCard = IdCard;
		this.Card = Card;
		//this.AllMoney = AllMoney;
		this.Money = Money;
		this.MiMa = MiMa;
	}
	
	public int M() {
		return MiMa;
	}
	
	public double Chun(double money) {
		this.Money += money;
		return this.Money;
	}
	
	public  void KaiTong() {
		System.out.println("名字;"+name);
		System.out.println("身份证;"+IdCard);
		System.out.println("卡号; "+Card);
		System.out.println("当前余额"+Money);
		System.out.println("密码"+MiMa);
	}
	
	public void Cha(int mima) {
		if(mima == this.MiMa) {
		}
		else {
			
		}	
	}
	
	public double AllMoney() {
		double allMoney =this.Money;
		return allMoney;
	}
	
	public void getMoney(double money) {
		double d = (double)Money - money;
		if(this.Money < 0) {
			System.out.println("您的卡上没这么多钱,此操作不能执行");
			this.Money = AllMoney();
		}
		else {
			this.Money = d;
		}
	}
}
//测试类
import java.util.*;

public class BankTest {

	public static void main(String[] args) {
		
		Bank b = new Bank("周","430481198701012120","95599810920042125",25000,123);
		System.out.println("您开的银行卡信息;");
		b.KaiTong();
		Scanner sc = new Scanner(System.in);
		System.out.println("如果您要转到其他服务请任意按个数字");
		int x = sc.nextInt();
		System.out.println("请输入密码;输入密码时请您一定要一次性输入正确,否则ATM机会吞卡");
		int m = sc.nextInt();
		while(m != b.M()){
			
					System.out.println("密码错误");
					
			
		}
		System.out.println("如果您要取款请按1 查询按2 ");
		int button = sc.nextInt();
		switch(button) {
		case 1:
			System.out.println("输入要取的金额;");
			double getM = sc.nextDouble();
			b.getMoney(getM);
			b.Cha(m);
			System.out.println("查询按2");
			int j = sc.nextInt();
			if(j == 2) {
				System.out.println("当前余额"+b.Money);
			}
			
		}
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -