Address book program in Java
<p>I'm just doing a small program. It's an address book which has four options:</p>

<ol>
<li>insert new contact</li>
<li>search contact by last name</li>
<li>delete contact by name</li>
<li>show all contacts</li>
<li>exit program</li>
</ol>

<p>Just wondering how to get the insert contact part and how to store it. I've hardcoded one contact to test it.</p>

<p>Here is my code I have started</p>

<pre><code>package addressbook;
import java.util.Scanner;

public class addressbooks
{


    public static void main(String[] args)
    {
        Scanner input = new Scanner(System.in);

        //create a table to hold information

        String[][] addressbooks = new String[100][8];

        addressbooks[0][0]="Mobile Number";
        addressbooks[0][1]="First Name";
        addressbooks[0][2]="Last Name";
        addressbooks[0][3]="Address";
        addressbooks[0][4]="City";
        addressbooks[0][5]="County";
        addressbooks[0][7]="Telephone Number";

        //pre-populate address book for testing purposes and records

        addressbooks[1][0]="1";
        addressbooks[1][1]="David";
        addressbooks[1][2]="Needham";
        addressbooks[1][3]="Sraheens, Achill";
        addressbooks[1][4]="Galway";
        addressbooks[1][5]="Mayo";
        addressbooks[1][6]="086-1581077";
        addressbooks[1][7]="098-45368";

        addressbooks[2][0]="2";
        addressbooks[2][1]="Mc";
        addressbooks[2][2]="lovin";
        addressbooks[2][3]="Hawaii";
        addressbooks[2][4]="Hawaii";
        addressbooks[2][5]="Hawaii";
        addressbooks[2][6]="12345";
        addressbooks[2][7]="412-555-1234";

        //menu options
        System.out.print("Welcome to my Address book!");
        System.out.print("\n");
        System.out.print("\n1 - Insert a New Contact \n2 - Search Contact by Last Name \n3 - Delete Contact \n4 - Show All Contacts \n5 - Exit " );
        System.out.print("\n");
        System.out.print("\nChoose your option: ");

        int option = input.nextInt();

        if (option ==1)
        {
            System.out.print("\nPlease enter your First Name : ");
        }
        if (option ==2)
        {
        }

        if (option ==3)
        {
        }

        if (option ==4)
        {
        System.out.println(addressbooks[1][0]+
        "\t"+addressbooks[1][2]+ ", "+addressbooks[1][1]+
        "\n\t"+addressbooks[1][3]+
        "\n\t"+addressbooks[1][4]+ ", "+addressbooks[1][5]+ " "+addressbooks[1][6]+
        "\n\t"+addressbooks[1][7]);
        }

        if (option ==5)
        {
        }

    }
}
</code></pre>
