Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a class MapIntersectClient and write a method mapIntersect in that class that accepts two maps whose keys are strings and whose values are integers

Create a class “MapIntersectClient” and write a method mapIntersect in that class that accepts two maps whose keys are strings and whose values are integers as parameters and returns a new map containing only the key/value pairs that exist in both of the parameter maps. In order for a key/value pair to be included in your result, not only do both maps need to contain a mapping for that key, but they need to map it to the same value. For example, if the two maps passed are {Janet=87, Logan=62, Whitaker=46, Alyssa=100, Stefanie=80, Jeff=88, Kim=52, Sylvia=95} and {Logan=62, Kim=52, Whitaker=52, Jeff=88, Stefanie=80, Brian=60, Lisa=83, Sylvia=87}, your method would return the following new map (the order of the key/value pairs does not matter): {Logan=62, Stefanie=80, Jeff=88, Kim=52}. Please write main method inside this class and create , initialize maps and pass them to the mapIntersect method and print the returned map.


Step by Step Solution

3.45 Rating (161 Votes )

There are 3 Steps involved in it

Step: 1

To determine To create a java program that maps the strings and displays the output accordingly Prog... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Physics

Authors: David Young, Shane Stadler

10th edition

1118486897, 978-1118836873, 1118836871, 978-1118899205, 1118899202, 978-1118486894

More Books

Students also viewed these Programming questions

Question

1. Offer surprise rewards for good participation in class.

Answered: 1 week ago