Cos 160: Program 8- Star Sampler Objectives Creating a method with parameters. Part 1 (5 points) Drawing Polygons Java has a graphics method fillPolygon() for drawing any arbitray polygon. It works by taking arrays of the X and Y coordinates for the points and then drawing a polygon whose border goes from point to point and then returns to the starting point. Its API description is: public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints) Fills a closed polygon defined by arrays of and y coordinates. This method draws the polygon defined by nPoints line segments, where the first nPoints 1 line segments are line segments from (xPoints[i 11, yPoints[i 1]) to (xPoints[i], yPoints[I), for 1 si s nPoints. The figure is automatically closed by drawing a line connecting the final point to the first point, if those points are different. The area inside the polygon is defined using an even-odd fill rule, also known as the alternating rule. Parameters: xPoints- an array of x coordinates yPoints an array of y coordinates nPoints - the total number of points. See Also: drawPolygon(int[), int[], int) Test it by making a little test program that makes arrays of x and y coordinates and draws a polygon. Part 2 (10 points) Method to draw a filled regular polygor po po p1 p7, P4 p1 6 p2. p5 p3 p3 p2 p4 points 8 points = 5 Cos 160: Program 8- Star Sampler Objectives Creating a method with parameters. Part 1 (5 points) Drawing Polygons Java has a graphics method fillPolygon() for drawing any arbitray polygon. It works by taking arrays of the X and Y coordinates for the points and then drawing a polygon whose border goes from point to point and then returns to the starting point. Its API description is: public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints) Fills a closed polygon defined by arrays of and y coordinates. This method draws the polygon defined by nPoints line segments, where the first nPoints 1 line segments are line segments from (xPoints[i 11, yPoints[i 1]) to (xPoints[i], yPoints[I), for 1 si s nPoints. The figure is automatically closed by drawing a line connecting the final point to the first point, if those points are different. The area inside the polygon is defined using an even-odd fill rule, also known as the alternating rule. Parameters: xPoints- an array of x coordinates yPoints an array of y coordinates nPoints - the total number of points. See Also: drawPolygon(int[), int[], int) Test it by making a little test program that makes arrays of x and y coordinates and draws a polygon. Part 2 (10 points) Method to draw a filled regular polygor po po p1 p7, P4 p1 6 p2. p5 p3 p3 p2 p4 points 8 points = 5