Question
In cartography, a contour line (often just called a contour) joins points of equal elevation (height) above a given level, such as mean sea level.
In cartography, a contour line (often just called a "contour") joins points of equal elevation (height) above a given level, such as mean sea level.
The following code creates a Hashmap, P, which stores point/height pairs to record the height at a specific coordinate point. However, the plots of contour lines want to find the points at specific heights. Therefore a method mapSortedByHeight is added to print out P in ascending order by the height values.The strategy of this method is to go through each of the point/height pair and add that information to a new H map that associates each height with a list of the points that have the same height.(Because there may be many points that have the same height, the value in the H map needs to be a list of points). Finally, it goes through this H map in order by height and produces the desired output.Complete the seven missing lines as indicated in the numbered comments.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started