Question: Make Java class named Book to build a simple phonebook program that reads in a series of name-number pairs from the user (that is, name

Make Java class named "Book" to build a simple phonebook program that reads in a series of name-number pairs from the user (that is, name and number on one line separated by whitespace) and stores them in a Map from Strings to Integers. The user should enter "quit" when they are finished. Then ask the user for a name and return the matching number, or tell the user that the name wasn't found.  If the user types the input given below(Bill), then your programs output should be "243-7787". If the last line of the user input had been a name not in the original list (e.g., "Aaron"), then your programs output should be "Number not listed." 

 

Dale 572-0423 

Hank 572-8841 

Bill 243-7787 

quit 

Bill

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!