一个简单的ATM机系统

用链表结构在文件中存储用户信息,实现了ATM机的基本功能,其中还有些问题没有搞懂,代码存在冗余,细节还存在一些问题等,还要继续努力!
package ATMSystem;

import java.io.Serializable;

/**
 * 
 * @author zz384dian
 * @description 用户信息
 */
public class User implements Serializable{

	public String username;
	public String password;
	public double money;
	
	public User(){
		
	}
	
	public User(String username, String password, double money) {
		super();
		this.username = username;
		this.password = password;
		this.money = money;
	}

	public void setMoney(double money) {
		this.money = money;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		long temp;
		temp = Double.doubleToLongBits(money);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		result = prime * result + ((password == null) ? 0 : password.hashCode());
		result = prime * result + ((username == null) ? 0 : username.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		User other = (User) obj;
		if (Double.doubleToLongBits(money) != Double.doubleToLongBits(other.money))
			return false;
		if (password == null) {
			if (other.password != null)
				return false;
		} else if (!password.equals(other.password))
			return false;
		if (username == null) {
			if (other.username != null)
				return false;
		} else if (!username.equals(other.username))
			return false;
		return true;
	}
	
	
}
package ATMSystem;
/**
 * 
 * @author zz384dian
 * @description 输入操作有误异常
 */
public class OperatorException extends Exception{

    public OperatorException(){
		
	}
	
	public OperatorException(String message){
		super(message);
	}
}
package ATMSystem;
/**
 * 
 * @author zz384dian
 * @description money不够异常
 */
public class MoneyNotEnough extends Exception{

	public MoneyNotEnough
  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值