Dynamic Binding in Polymorphism

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

My professor's feedback:

The only class that should be doing any printing (System.out.println()) is the BankAccountDemo test driver class.

In your inheriting classes: (-4)

- In the withdraw() methods, your if statement’s condition should be checking if the balance - amount > MIN_BALANCE rather than just the current balance. Then, if the condition passes (is true), it should call super.withdraw(amount); to get the BankAccount’s withdraw() method do the actual withdrawal calculation.

In your BankAccountDemo class: (-4)

- According to the specs for the output, you should be withdrawing three separate amounts: 200.0, 360.0, and 2.00 from each of the created accounts. You can do this in three successive for loops like this:

Note that Canvas removes all indentation :-(

for (int i = 0; i < accounts.length; i++) {
// calls each object’s toString()
accounts[i].withdraw(200.0);

System.out.println();
}

Then, just have two more for loops like the one above for the withdrawal amounts of 360.0 and 2.00.

humananimalcomputerlanguag