Java Phonebook With Arrays // HELP! //
having a bit of trouble, could use some pointers.
Write an application that allows a user to enter the names and phone numbers of up to 20 friends. Continue to prompt the user for names and phone numbers until the user enters "zzz" or has entered 20 names, which ever comes first. When the user is finished entering names, produce a count of how many names were entered, but make certain to count the application-ending dummy "zzz" entry. Then display the names. Ask the user to type one of the names and display the corresponding phone number. Save the application as phonebook.java
Here is the code I have written so far:
public class phonebook
final int maxContacts = 3;
double pNums = new double;
String pNames = new String;
boolean nameWasFound = true;
Scanner keyboard = new Scanner(System.in);
public void getInfo()
for(x = 0; x < maxContacts; ++x)
System.out.println("Please enter a name ");
pNames[x] = keyboard.next();
System.out.println("Please enter their phone number ");
pNums[x] = keyboard.nextDouble();
System.out.println(""+pNames[x]); //I want to display all the names here, comes back null.
System.out.println("Please enter a name to find "); // no idea how to search a name and display the corresponding number!
nameSearch = keyboard.next();
System.out.println("The name is"+pNames[x]);
public static void main(String args)
phonebook show = new phonebook();
Re: Java Phonebook With Arrays // HELP! //
Im having major problems with java. I have to a program that reads name and numbers into two arrays of Strings. Then the program will print out the two arrays in a meaningful way. Then the program will set up a loop and inside the loop, the program will print out a menu as follow.
1. Check a name
2. Check a number
3. Change a name
4. Change a number
5. Add a name and a number
6. Print all names and numbers
Please if someone could HELP ME!!!!!!!