Lecture 16
9
switch (Bank.java 116)
•String accountName = atm.readWord
• ("Account name: " );
•char accountType = atm.readChar
• ("Check/Fee/Reg/Sav? (c/f/r/s): " );
•int start = atm.readInt("Initial deposit: " );
•BankAccount newAccount;
•switch( accountType ) {
•   case 'c': newAccount = new CA( bal, this );
•             break;
•   case 'f': newAccount = new FA( bal, this );
•             break;
•   default:  atm.println
• ("invalid account type: " + accountType);
•     return;
•}
New keywords in red.
Text is pasted from Bank.java, but variable and class names have been abbreviated to fit on slide.