Class PhoneBook

java.lang.Object
  extended by PhoneBook

public class PhoneBook
extends Object

A class that represents a phone book. This phone book maps names to phone numbers. This will read the phone book information from a file.


Constructor Summary
PhoneBook(String file)
          Constructor that takes a file name and reads in the names and phone numbers from a file
 
Method Summary
 String getPhoneNumber(String name)
          Get the phone number for the passed name
static void main(String[] args)
           
 void printBook()
          Method to print out the contents of the phone book
 void readInfoFromFile()
          Method to read the phone information from a file and use it to fill the map
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PhoneBook

public PhoneBook(String file)
Constructor that takes a file name and reads in the names and phone numbers from a file

Parameters:
file - the name of the file to read
Method Detail

getPhoneNumber

public String getPhoneNumber(String name)
Get the phone number for the passed name

Parameters:
name - the name to look up in the map
Returns:
the phone number if found, else null

readInfoFromFile

public void readInfoFromFile()
Method to read the phone information from a file and use it to fill the map


printBook

public void printBook()
Method to print out the contents of the phone book


main

public static void main(String[] args)