
10.4 Programming Activity 1: Using Inheritance 683
10.4 Programming Activity 1: Using Inheritance
For this Programming Activity, you will create the SavingsAccount class,
which inherits directly from the BankAccount class. The SavingsAccount
class is similar to the CheckingAccount class in that both classes inherit from
BankAccount. Figure 10.9 shows the resulting hierarchy.
Figure 10.9
Bank Account Hierarchy
Object
BankAccount
SavingsAccountCheckingAccount
+toString( ) : String
+. . . ( )
+MONEY : DecimalFormat = $#,##0.00
–balance : double
+BankAccount( )
+BankAccount(in startBalance : double)
+getBalance( ) : double
+deposit(in amount : double) : void
+withdraw(in ...