import SimpleOutput;
import java.util.Hashtable;
import java.util.Enumeration;

public class SimpleDirectory {

    // create Hashtable and SimpleOutput objects
    protected Hashtable table;
    protected SimpleOutput myOut = new SimpleOutput();

    // constructor
    SimpleDirectory () {
        table = new Hashtable();
    }

    // methods
    // add a name-number entry
    public void add (String name, String number) {
        table.put (name, number);
    }

    // retrieve the number for a name
    public String lookup (String name) {
        return (String) table.get(name);
    }

    // print all names
    public void printNames () {
        myOut.println ("The names in the directory are: ");
        for (Enumeration e = table.keys(); e.hasMoreElements() ;) {
            myOut.println ("   " + e.nextElement());
        }        
    }
}
