import java.util.*;
public class KeywordSearch {
Scanner input = new Scanner(new File("keyvalues.txt"));
Map<String, Integer> wordCountMap = getCountMap(in);
for (String word: wordCountMap.keySet()) {
int count = wordCountMap.get(word);
while (input.hasNextLine()) {
line = input.nextLine();
numLine++;
Scanner word = new Scanner(line);
while (word.hasNext()){
String nextWord = word.next();
numWord++;
numChar = numChar + nextWord.length();
}
if (salaryMap.containsKey(name)) {
double salary = salaryMap.get(name);
System.out.println(name + "'salary is $" salary);
} else {
System.out.prinln("I don't hava a record for " + name);
}
a program that reads in a file that contains a list of keys and values. Each line of
the file contains a key and a value, separated by whitespace. Using a Scanner, read the
entire file of keys and values into a map. Then, in a loop, prompt the user with "Key:"
read from the console a key. If the key is present in the file, respond with "Key <key>
has value <value>". If the key does not exist, respond with "Key <key> does not exist.
The user types "Q" to exit the program.