Books - 15-121: Introduction to Data Structures Exercise...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 15-121: Introduction to Data Structures Exercise 11/23/2009 Relevant Reading: • Sections of the API on Maps. Books (Maps) Fall 2009 Due: Fri, Dec 4 5pm Assignment: (worth 5 exercise points) You may work in pairs on this exercise. 1) Consider files of book authorship information. Each line contains the information on one book. The line has the author's name, a colon, and the name of the book. For example: Dr. Seuss:How The Grinch Stole Christmas Agatha Christie:Murder on the Orient Express Samples are in: Books-data.zip Write a program that asks the user for the name of a file of book information. The program should then read that information into a java Map, where authors are the keys, and the values are a list of books that the author has written. The program should then give a list of the authors, and ask the user to type in the name of an author. If the author the user enters an author's name that is not in the Map, then the program should say that the author has not written any books that our database knows about. If the author's name IS in the Map, the program should display a list of the books he or she has written, in alphabetical order. The user should be able to keep typing in author's names as long as they wish. Each name gets the result described above. 2) Write a short essay discussing the advantages and disadvantages of using a TreeMap and using a HashMap for this exercise. Handin: • Create a zip file containing all of the necessary java files. Submit this zip file via handin. If you have problems, contact me. ...
View Full Document

This document was uploaded on 12/19/2009.

Ask a homework question - tutors are online