Add a 'Search' feature to the system that allows the user to search the contact list for a particular contact's name:
Add a method to the contact list class for searching the list. This method should take a name as a parameter and use that name to search through the ArrayList
, comparing it to the names for each contact. When a match is found, the matching item should be returned.
If there is no match then the method should return null
.
Extend the menu in the application class to add a 'Search' option.
Add another static
method that will prompt the user for a name. The name that the user enters should then be passed to the 'search' method of the contact list object, and if 'search' method does not return null
then the returned object should be printed to the console.