Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package day11.bank;
- public abstract class Account {
- private String category;
- private String owner;
- private int rate;
- private int balance;
- public Account() {
- }
- public Account(String category, String holder, int rate) {
- this.category = category;
- this.owner = holder;
- this.rate = rate;
- this.balance = 0;
- System.out.println(getAccountInfo());
- }
- public String getCategory() {
- return category;
- }
- public void setCategory(String category) {
- this.category = category;
- }
- public String getOwner() {
- return owner;
- }
- public void setOwner(String owner) {
- this.owner = owner;
- }
- public int getRate() {
- return rate;
- }
- public void setRate(int rate) {
- this.rate = rate;
- }
- public int getBalance() {
- return balance;
- }
- public void setBalance(int balance) {
- this.balance = balance;
- }
- public String getAccountInfo() {
- return "계좌명 : " + category + "예금계좌, 예금주 : " + ", 이율 : " + rate + "%, 잔액 : " + balance;
- }
- public int withdraw(int amount) {
- if (balance >= amount) {
- balance -= amount;
- return 0;
- }
- return -1;
- }
- public void deposit(int amount) {
- balance += amount;
- }
- }
Add Comment
Please, Sign In to add comment