We will now add two operations to the AddressBook class, one to put an entry into an AddressBook and another to look up an address for a name.
To add a put Operation to AddressBook
Type the Alf code shown in the following figure.
To add a get Operation to AddressBook
Type the Alf code shown in the following figure.
You may want to consider yourself how to code a remove(name: String) Operation that removes an entry from an AddressBook. |
Next: Testing the AddressBook