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.
35 lines
924 B
35 lines
924 B
2 years ago
|
package org.poopki.duckdns.user_db.Array;
|
||
3 years ago
|
|
||
|
public class Account {
|
||
|
private int m_Balance;
|
||
3 years ago
|
private int MAX_BALANCE = 2147483647;
|
||
3 years ago
|
public Account(int Balance){ // Account Balance 초기화
|
||
3 years ago
|
m_Balance = Balance;
|
||
|
}
|
||
3 years ago
|
public boolean setBalance(Long Amount){
|
||
|
if(Amount<MAX_BALANCE) {
|
||
|
m_Balance = Amount.intValue();
|
||
|
return true;
|
||
|
}else{
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
3 years ago
|
public int getBalance(){ return m_Balance; } //잔액 return
|
||
3 years ago
|
public boolean credit(Long Amount){ // 입금
|
||
|
if(m_Balance+Amount < MAX_BALANCE) {
|
||
|
m_Balance += Amount.intValue();
|
||
|
return true;
|
||
|
}
|
||
|
else{
|
||
|
return false;
|
||
|
}
|
||
3 years ago
|
}
|
||
3 years ago
|
public boolean withdraw(Long Amount){ // 출금
|
||
3 years ago
|
if(m_Balance >= Amount){
|
||
3 years ago
|
m_Balance -= Amount.intValue();
|
||
3 years ago
|
return true;
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
}
|