Question: jaba code please explain Create a class named Polygon that represents a geometric shape. - It should have data fields for the polygon's name and
Create a class named Polygon that represents a geometric shape. - It should have data fields for the polygon's name and its vertices (a list of at least three vertices, each having x and y coordinates). - It should have a constructor with parameters for the name and vertices, - Override the equals() method. It should consider two polygons as the same if they have the same name and the same set of vertices (regardless of vertex order). - Override the hashCode() method. Test your Polygon class by making sure it works properly with HashMap. Different Polygon objects with the same data should be considered the same by HashMap. In other words, when Polygon is used as a key, the two Polygon objects shouldn't result in two entries in the map. Turn in the following, - The source files (no zip file, just the individual java files). - A screen shot of your program in action. It should show the result of the test run
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
