/** * Write a description of class PhoneBook1 here. * * @author (your name) * @version (a version number or a date) */ import java.util.TreeMap; import java.util.*; import java.util.Scanner; public class PhoneBook1 { // instance variables - replace the example below with your own private String name, number; private Map entries ; /** * Constructor for objects of class PhoneBook1 */ public PhoneBook1(){ this.entries = new TreeMap(); } /** * An example of a method - replace this comment with your own * * @param y a sample parameter for a method * @return the sum of x and y */ public void addNumber(String name, String number){ this.entries.put(name, number); } public void remove(String name){ if (this.entries.containsKey(name)) System.out.println("found it"); this.entries.remove(name); } public void display(){ if (this.entries.isEmpty()) System.out.println("Empty"); for (Map.Entry entry : entries.entrySet()) { String value = entry.getValue(); String key = entry.getKey(); System.out.println(key + " " + value); } } }