
phonebook1
By:
ace on
Jan 27th, 2010 | syntax:
None | size: 0.92 KB | hits: 23 | expires: Never
import java.util.HashMap;
/**
* Write a description of class PhoneBook here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class PhoneBook
{
// instance variables - replace the example below with your own
private HashMap<String, String> phonebook;
/**
* Constructor for objects of class PhoneBook
*/
public PhoneBook()
{
// initialise instance variables
phonebook = new HashMap <String, String>();
}
/**
* 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
*/
private void enterNumber (String name, String number)
{
number = phonebook.put(name, number);
}
private String lookUpNumber (String name, String number)
{
return phonebook.put(name, number);
}
}