/*A personal phone directory contains room for list names and phone number for 30 people.
Assign names and phone numbers for the first 10 people.
Prompt the user for a name, and if the name is found in the list,display the corresponding
phone number.If the name is not found in the list,prompt the user for a phone number.
Add new name and phone number to the list
Continue to prompt the user for names until the users enters "quit".After the arrays are full
(containing 30 names))save the file as PhoneNumbers.java..*/
/* This program would use console/GUI,*/
import javax.swing.JOptionPane;
import java.util.Scanner;
public class PhoneDir
{
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
String[] arr=new String[30];
String inn;
System.out.println("The ten names and phone numbers");
arr[0]="kisa:2131\n";
arr[1]="john:123\n";
arr[2]="gary:456\n";
arr[3]="leah:789\n";
arr[4]="kim:101112\n";
arr[5]="noel:131415\n";
arr[6]="qrasy:161718\n";
arr[7]="tuvol:192021\n";
arr[8]="wave:222324\n";
arr[9]="dean:252627\n";
//for(int k=0;k<=9;k++)
//System.out.print(arr[k]);
for(int i=0;i<=arr.length;i++)
{
inn=JOptionPane.showInputDialog("Enter name:");
if(inn.compareTo(arr)==0){
System.out.println("\n\n\n\n"+arr);
}
else
{
int j=1;
arr[9+j]=inn+":"+input.nextInt();
j++;
}
}
for(int l=0;l<=arr.length;l++)
System.out.println(arr[l]);
}
}
i suppose to enter a 30 names to this to find if names i entered is in the 10 people i assign names and number is there and if it is in there it should diplay the name and the number..I would really appreciate if you well help me, I really needa help for this just read the problem if your quit confuse..thanks to all......