アットウィキロゴ

ouchi > Practice > Enshu02-21_Account

  1. public class Account {
  2.  
  3. private int accountNo;
  4. private int balance;
  5.  
  6. public Account(int accountNo) {
  7. super();
  8. this.accountNo = accountNo;
  9. }
  10.  
  11. public int getBalance() {
  12. return balance;
  13. }
  14.  
  15. public void addBalance(int balance) throws IllegalDebidException {
  16. this.balance += balance;
  17. if (this.balance <= 0) {
  18. throw new IllegalDebidException();
  19. }
  20. }
  21.  
  22. public int getAccountNo() {
  23. return accountNo;
  24. }
  25.  
  26. }
  27.  
最終更新:2013年05月17日 12:44