    // Class for an exercise.
class BalanceAccount {
    public void credit(long amount) throws RuntimeException {
        if(amount < 0){
            throw new RuntimeException("Negative credit: "+amount+
                                       " is not allowed.");
        }
        setBalance(getBalance()+amount);
    }

    public void debit(long amount) throws RuntimeException {
        if(amount < 0){
            throw new RuntimeException("Negative debit: "+amount+
                                       " is not allowed.");
        }
        setBalance(getBalance()-amount);
    }

    public long getBalance(){
        return balance;
    }

    private void setBalance(long b) {
        balance = b;
    }

    private long balance = 0L;
}
