X1145: Map Union

A teacher is tracking grades for two sections of a class using two maps. Each map uses the student's name as a key with their grade is the corresponding value, stored as a Double.

So far, the teacher has been keeping the two sections of the class in two seperate maps. However, now the teacher wants to combine both sections into one map.

Below, you see a class with two Map fields representing the two sections of the class. Implement the method mapUnion() so that it creates a new map that contains all the key/value pairs from both sections and then returns that new map. You can use either a HashMap or TreeMap here. You can assume that all name keys in both sections are unique.

Your Answer:

Feedback

Your feedback will appear here when you check your answer.