Okay, I have made a phonebook that does the follows,
- Add new contact
- Edit contact's phone
- Delete contact
- Search by name
- Search by phone
- View all contact
- Restore factory settings
- Exit
I've finished it and it's working properly, except one thing. If a name is stored for example "John" and the user searches for "john", it will print "not found", because j is not capitalized, how can I fix this without screwing up really bad with my code.
Here's the code for case 2 for example.
case 2: {
System.out.println("Enter the contact name you want to edit");
temp=s.next();
int z=name.indexOf(temp);
if(z!=-1)
{
System.out.println("Edit to?");
temp=s.next();
name.set(z, temp);
System.out.println("Name edited to "+temp);
}
else
System.out.println("Name not found");
break;
}