package java1;
public class Account {
String zhanghao;
double yue=0;
double add;
double get;
Account(String hao,double y)
{
zhanghao=hao;
yue=y;
}
double getAdd(double add)
{
yue+=add;
System.out.println("存钱"+add+"元,当余额为"+yue+"元");
return yue;
}
boolean getGet(double get)
{
if(get>yue)
{
System.out.println("取钱"+get+"元,当余额为"+yue+"元");
return true;
}
else
{
System.out.println("'余额不足");
return false;
}
}
//double getGet(double get)
//{
//yue-=get;
//System.out.println("取钱"+get+"元,当余额为"+yue+"元");
//return yue;
//}
double getYue()
{
System.out.println("账号为"+zhanghao+"当余额为"+yue+"元");
return yue;
}
}
Account a1= new Account("6000100020000", 500000);
a1.getAdd(10000);
a1.getGet(1);
a1.getYue();