This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: 15-121 SPRING 2009 [CORTINA/REID-MILLER]RECITATION 10In this lab, you will experiment with maps and sets in Java. EXERCISESDownload the project Lab10.zipwith a class named MapSetTesterwith a main method. You will be using the TreeSetand HashMapclasses, so open up the Java API so you can refer to the documentation for these classes as you work on these problems. (Our next lecture will cover hashing and the HashSetand HashMapclasses.) 1. In your main method, create a HashMapnamed networkMapthat maps a TV network to the television shows from that network. That is HashMapwill contain pairs where the key is a TV network name and the associated value is a TreeSetthat contains television shows from that network: Map<______,______> networkMap = new HashMap<______,______>();2. The loop reads the name of a television network and then the name of a TV show on that network from a file. Add the network and show to the hash map. That is, find the network in the hash map. a. If the network is not in the hash map yet, create a tree set with the name of the television show in it, and then add the key,value pair (network, set with 1 show) to the hash map. in it, and then add the key,value pair (network, set with 1 show) to the hash map....
View Full Document
This note was uploaded on 12/19/2009 for the course CS 121 taught by Professor Reid-miller during the Spring '09 term at Carnegie Mellon.
- Spring '09