lab10_001 - 15-121 FALL 2009 [CORTINA]LAB 10In this lab,...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the 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.

Page1 / 3

lab10_001 - 15-121 FALL 2009 [CORTINA]LAB 10In this lab,...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online