public class Account { private int balance; public int getBalance() { return balance; } public void setBalance(int balance) { this.balance = balance; } public Account(int balance){ this.setBalance(balance); } public int withDraw(int drawMount){ if(drawMount<0){ System.out.println("取款额为负数"); return 0; } else if(balance<drawMount){ System.out.println("余额不足"); return 0; }else{ balance=balance-drawMount; return drawMount; } } }
by: 发表于:2017-08-04 14:55:54 顶(0) | 踩(0) 回复
??
回复评论