public class Database_EMoney_Mandiri
{
private static Account[] accounts;
public Database_EMoney_Mandiri()
{
accounts = new Account[ 2 ];
accounts[ 0 ] = new Account( 51030, 12345, 10000.0);
accounts[ 1 ] = new Account( 51140, 54321, 100000.0 );
}
public static Account getAccount( int accountNumber )
{
for ( Account currentAccount : accounts )
{
if ( currentAccount.getAccountNumber() == accountNumber )
return currentAccount;
}
return null;
}
public boolean authenticateUser( int userAccountNumber, int userPIN )
{
Account userAccount = getAccount( userAccountNumber );
if ( userAccount != null )
return userAccount.validatePIN( userPIN );
else
return false;
}
public static double getSaldo( int userAccountNumber )
{
return getAccount( userAccountNumber ).getSaldo();
}
public static void beli( int userAccountNumber, double amount )
{
getAccount( userAccountNumber ).beli( amount );
}
}