June 24th, 2011 07:40 AM
#1
Java Address Book
Ok first off, yes I am a student and this is a project I am working on for class. Second, I am new to programming but so far I enjoy it and look forward to learning more. Third I am not looking for someone to do my work for me I just need help and feedback.*
Now what I am stuck on is making my menu options work (add new entry, delete, search, display, and exit), a loop for the menu options, at least one method, and two looping methods. Again I am not looking for you to do this for me I just want feedback and tips because again I do like this and I want to get more into programming.*
Here is my code:
package address_book;
import java.util.Scanner;
*public class Address_book*
{
public static void main(String[] args)*
{
Scanner input = new Scanner(System.in);
** * **
//create matrix table to hold information
String[][] AddressBook = new String[100][8];
** * * **
AddressBook[0][0]="Contact Number";
AddressBook[0][1]="First Name";
AddressBook[0][2]="Last Name";
AddressBook[0][3]="Address";
AddressBook[0][4]="City";
AddressBook[0][5]="State";
AddressBook[0][6]="Zip";
AddressBook[0][7]="Telephone Number";
** * * *
//pre populate address book for testing purposes and records
AddressBook[1][0]="1";
AddressBook[1][1]="Adam";
AddressBook[1][2]="West";
AddressBook[1][3]="1 Batcave Lane";
AddressBook[1][4]="Gotham City";
AddressBook[1][5]="NY";
AddressBook[1][6]="12345";
AddressBook[1][7]="123-456-7890";
** * * *
AddressBook[2][0]="2";
AddressBook[2][1]="John";
AddressBook[2][2]="Doe";
AddressBook[2][3]="1234 Any Street";
AddressBook[2][4]="Anytown";
AddressBook[2][5]="PA";
AddressBook[2][6]="12345";
AddressBook[2][7]="412-555-1234";
** * * * **
//menu options
System.out.print("Menu");
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("\nChoose your option: ");
int option = input.nextInt();
** * * * * * *
if (option ==1)
** * * * * *{
** * * * * *}
** * * *
if (option ==2)
** * * * * *{
** * * * * *}
** * * *
** * * *if (option ==3)
** * * * * *{
** * * * * *}
*
if (option ==4)
** * * * * *{
** * * * * * * *System.out.println(AddressBook[1][0]+*
"\t"+AddressBook[1][2]+ ", "+AddressBook[1][1]+*
"\n\t"+AddressBook[1][3]+*
"\n\t"+AddressBook[1][4]+ ", "+AddressBook[1][5]+ " "+AddressBook[1][6]+*
"\n\t"+AddressBook[1][7]);
** * * * * *}
** * * *
if (option ==5)
** * * * * *{
** * * * * *}
** * * *
** *}
}
Tags for this Thread
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width
Bookmarks