You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
924 B
34 lines
924 B
package org.poopki.duckdns.user_db.Array; |
|
|
|
public class Account { |
|
private int m_Balance; |
|
private int MAX_BALANCE = 2147483647; |
|
public Account(int Balance){ // Account Balance 초기화 |
|
m_Balance = Balance; |
|
} |
|
public boolean setBalance(Long Amount){ |
|
if(Amount<MAX_BALANCE) { |
|
m_Balance = Amount.intValue(); |
|
return true; |
|
}else{ |
|
return false; |
|
} |
|
} |
|
public int getBalance(){ return m_Balance; } //잔액 return |
|
public boolean credit(Long Amount){ // 입금 |
|
if(m_Balance+Amount < MAX_BALANCE) { |
|
m_Balance += Amount.intValue(); |
|
return true; |
|
} |
|
else{ |
|
return false; |
|
} |
|
} |
|
public boolean withdraw(Long Amount){ // 출금 |
|
if(m_Balance >= Amount){ |
|
m_Balance -= Amount.intValue(); |
|
return true; |
|
} |
|
return false; |
|
} |
|
}
|
|
|