package nxh;
public class Account {
private int id;
private double money;
private static int now=111111; //账号
public Account(){
this.id=now;
this.money=0;
System.out.println("账号"+id+"余额为"+this.money);
now++;
}
public Account(double money){
this.id=now;
this.money=money;
now++;
}
public void save(double money){//存钱
this.money=this.money+money;
System.out.println("账号"+id+"存钱"+money+"成功"+"余额为"+this.money);
}
public void withdraw(double money){ //取钱方法
if(money<=this.money){
this.money=this.money-money;
System.out.println("取钱"+money+"成功");
}else{
System.out.println("取钱"+money+"不成功,余额不足");
}
}
public double getBalance(){//余额
return money;
}
public int getId(){
return this.id;
}
}