代码拉取完成,页面将自动刷新
package ch1;
import java.util.Date;
public class Account {
private String id,name;
private double balance;
private Date datetime;
public double getBalance(){
return balance;
}
public void setBalance(double balance){
this.balance=balance;
}
public Date getDatetime(){
return datetime;
}
public void setDatetime(Date datetime){
this.datetime=datetime;
}
public Account(String id,String name,double balance){
this.id=id;
this.name=name;
this.balance=balance;
this.datetime=new Date();
}
public Account(){
this.id=" ";
this.name=" ";
this.balance=0;
this.datetime=new Date();
}
public void deposite(double money){
this.balance=this.balance+money;
}
public void withdraw(double money){
if(this.balance<money){
System.out.println("您的余额不足,无法取钱");
return;
}
this.balance=this.balance-money;
}
public void changemoney(Account other,double money){
if(this.balance<money){
System.out.println("您的余额不足,无法转账");
return;
}
this.balance=this.balance-money;
other.balance=other.balance+money;
}
public void print(){
System.out.println("账号:"+id+" 户名:"+name+" 余额:"+balance);
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。