X1138: Add entries to HashMap

Consider a dictionary that given an English word, returns the Spanish word. Add new English-Spanish word pairs to the dictionary.

Remember, you add words to a HashMap by calling the put() method. dictionary.put( <<word english>>, <<word in spanish>>)

Write a method that adds the following English-Spanish word pairs to the dictionary:

AخA
 
1
"dog", "perro"
2
"cat", "gato"
3
"guinea pig", "cobaya"
4
"fish", "pez"
5
"bird", "pájaro"
6
"parakeet", "perico"
7
"turtle", "tortuga"
8
"snake", "serpiente"

Your Answer:

x
 
1
void addNewWords()
2
{
3
    // one line per set of word added
4
    dictionary.put(<<english>>, <<spanish>>);
5
}
6

Feedback

Your feedback will appear here when you check your answer.