SHARE
TWEET

Untitled

a guest Jan 22nd, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package day11.bank;
  2.  
  3. public abstract class Account {
  4.  
  5.     private String category;
  6.     private String owner;
  7.     private int rate;
  8.     private int balance;
  9.  
  10.     public Account() {
  11.  
  12.     }
  13.  
  14.     public Account(String category, String holder, int rate) {
  15.         this.category = category;
  16.         this.owner = holder;
  17.         this.rate = rate;
  18.         this.balance = 0;
  19.  
  20.         System.out.println(getAccountInfo());
  21.     }
  22.  
  23.     public String getCategory() {
  24.         return category;
  25.     }
  26.  
  27.     public void setCategory(String category) {
  28.         this.category = category;
  29.     }
  30.  
  31.     public String getOwner() {
  32.         return owner;
  33.     }
  34.  
  35.     public void setOwner(String owner) {
  36.         this.owner = owner;
  37.     }
  38.  
  39.     public int getRate() {
  40.         return rate;
  41.     }
  42.  
  43.     public void setRate(int rate) {
  44.         this.rate = rate;
  45.     }
  46.  
  47.     public int getBalance() {
  48.         return balance;
  49.     }
  50.  
  51.     public void setBalance(int balance) {
  52.         this.balance = balance;
  53.     }
  54.  
  55.     public String getAccountInfo() {
  56.         return "계좌명 : " + category + "예금계좌, 예금주 : " + ", 이율 : " + rate + "%, 잔액 : " + balance;
  57.     }
  58.  
  59.     public int withdraw(int amount) {
  60.         if (balance >= amount) {
  61.             balance -= amount;
  62.             return 0;
  63.         }
  64.         return -1;
  65.     }
  66.    
  67.     public void deposit(int amount) {
  68.         balance += amount;
  69.     }
  70. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top