1 Star 0 Fork 0

青菜的宝贝/升级窗口

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Account.java 1.45 KB
一键复制 编辑 原始数据 按行查看 历史
青菜的宝贝 提交于 2021-09-18 05:13 . 账户类
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);
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/baby-of-green-vegetables/upgrade-window.git
git@gitee.com:baby-of-green-vegetables/upgrade-window.git
baby-of-green-vegetables
upgrade-window
升级窗口
master

搜索帮助