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 FALL 2009 [CORTINA]LAB 10In this lab, you will experiment with maps and sets in Java. EXERCISESCreate a project in Eclipse named Lab10with a class named MapSetTesterwith a main method. You will be using the HashMapand TreeSetclasses, so open up the Java API so you can refer to the documentation for these classes as you work on these problems. 1. In your main method, create a HashMapnamed networkMapthat will store key,value pairs where the key is a TV network name and the associated value is a TreeSetthat contains television shows from that network: HashMap<______,______> networkMap = new HashMap<______,______>();2. In a loop, ask the user for the name of a television show and then ask the user for the name of the TV network for that show. After you have the input values, 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.b. If the network is in the hash map, add the television show to the tree set for that network....
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