CSCI-1320 Lab: Table Data

Instructor: Todd Dole

Purpose Statement

This program gives practice using corresponding arrays and/or arrays of objects.

Instructions

In this program, we are going to begin to build a Contact Book program.

You will create a set of data using either corresponding arrays or an array of objects (using a class you create with all public attributes and no methods).

Your data should contain the following:

Populate the data with 10 contacts. You can use real people or made up people--I will not use your data for any purpose other than grading, or share it with anyone. You will hard code the data into your code, similar to how we demonstrated in class.

Then, in your main method, you will prompt the user for name lookup, and then display relevant data (choose at least 3 fields) for the matching users in a table format.

For example:

                Search for contact, or enter for all contacts: Dole
                Contacts matching Dole:

                Jill Dole            325-555-1212        jilldole@junkmail.com      1/2/1981
                Jenny Dole           405-555-1234        miadole@junkmail.com       2/4/2006
                Bart Dole            325-555-8765        bartdole934232@gmail.com   12/25/2009
            

If the user enters a blank line, you should display all contacts in the list.

Hint: You will need to iterate through the data and check each contact to see if it's a match.
You can use indexOf to see if the search String is contained in the contact String.
indexOf will return -1 if it doesn't find the String.
Experiment with indexOf("") and see what it returns--it may help you figure out how to print the whole list if the user enters nothing.

Submit your working .java file through Canvas.