I need to make some kind of phone book using HashMap.
- If I enter a number the program must ask to enter corresponding name and save that as key and value
- If I type name, then I must enter the number as well.
number is a key, name is a value.
else if (isPhone(input)) {
if (phoneBook.containsKey(input)) {
System.out.println("This number reserve by => " + phoneBook.get(input));
} else {
System.out.println("Enter number's owner: " + input);
String name = scanner.nextLine();
if (isName(name)) {
System.out.println("Accept!");
phoneBook.put(input, name);