|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectPhoneBook
public class PhoneBook
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 |
---|
public PhoneBook(String file)
file
- the name of the file to readMethod Detail |
---|
public String getPhoneNumber(String name)
name
- the name to look up in the map
public void readInfoFromFile()
public void printBook()
public static void main(String[] args)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |