import java.math.BigDecimal;
public class DollarAccount extends BankAccount
{
static private long toCents(long units, int cents) {
return 100*units+cents;
}
public DollarAccount()
{
super(0);
}
public DollarAccount(long units, int cents) {
super(toCents(units,cents));
}
public void deposit(long units, int cents) {
super.deposit(toCents(units,cents));
}
// what happens if we try to override getBalance
public BigDecimal getBalance() {
BigDecimal cents = new BigDecimal(super.getBalance());
return cents.scaleByPowerOfTen(-2);
}
}