- 业务逻辑更符合
-
操作类中的case里的内容改写为方法,case只需要进行方法的调用
-
密码 不在乎大小写
VipMember.java:VIp成员类
package Test_vipSystem;
public class VipMember {
private String name;
private String accountNumber;
private String password;
private int point;
public VipMember(){
}
public VipMember(String name, String accountNumber, String password, int point) {
this.name = name;
this.accountNumber = accountNumber;
this.password = password;
this.point = point;
}
public void pointSum(double consumptionMoney){
//floor(3.14) 结果是3.0是double 并不是整数类型
// setPoint(Math.floor(consumptionMoney));//出错? 不兼容的类型: 从double转换到int可能会有损失
int temp = (int)Math.floor(consumptionMoney);//强制类型转换
setPoint(temp+getPoint());
System.out.println(“积分成功!”);
}
public double exchangeCaculate(int exchangePoint){
if(point >= 100&& point>exchangePo