(20 points)
In this assignment, you will practice doing the following:
Overview
The goal of this assignment is to display repetitive graphics patterns in a window.
The display part is complete and is in the class ViewWindow (The code in ViewWindow is beyond the scope of this course. You don't need to understand what it does. It is not complicated but it requires some knowledge of the Sun graphics library). The window features 3 radio buttons to display 3 different patterns. It also has a command button to change the colors of the pattern which is displayed.
The patterns are created in the class GraphicsElements, which the class that you need to complete. The class has three methods to create three patterns: a pie made of wedges of different colors, a pattern of stripes and a Koch snow flake (see below for more explanations). The class Graphics elements contains also other methods to modify the colors of these patterns.
Some details
The pie
It is created in the method
public ArrayList createAPie()
The pie is made of identical wedges of different colors. The number of wedges can be anywhere between 1 and NUMBER_OF_PIE_WEDGES = 100. This number is given by the user. To do the input, use a dialog box (method readIntDialog in uwcse.io.Input). If the user gives an invalid value, display an error message (use JOptionPane.showMessageDialog) and ask for the entry again.
The colors of the wedges are randomly chosen. Make sure that the pie is as big as the window allows. Create the wedges as Arc objects. Store these Arcs in an ArrayList and return that list.
Below is an example

The method
public ArrayList rotateColorsInPie(ArrayList graphicsList)
should change the colors of the wedges of the pie, so that the wedges appear to move in a clockwise direction.. Modify the colors of the elements of the pie (available in graphicsList) and return the updated ArrayList. For example, after clicking one time on the "Change colors" button, the above pie becomes

The pattern of stripes
It is created in the method
public ArrayList createStripes()
The number of stripes of one color can be anywhere between 1 and MAXIMUM_NUMBER_OF_STRIPES = 15. This number is given by the user. To do the input, use a dialog box (method readIntDialog in uwcse.io.Input). If the user gives an invalid value, display an error message (use JOptionPane.showMessageDialog) and ask for the entry again.
Use only two colors to create the stripes (e.g. blue and yellow). Make sure that the pattern is as big as the window allows.
Below is an example with 3 blue stripes:
To create the stripes, use Triangles. For instance, to create the above pattern, start with a board of 3 by 3 squares. Then divide each square into 2 triangles (one blue and one yellow), as shown on the figure below. Store all of these triangles in an ArrayList and return that ArrayList.

The method
public ArrayList flipColorsInStripes(ArrayList graphicsList)
should change the colors of the triangles to the other available color. For example, if the pattern is made of blue and yellow triangles, a blue square should become yellow and vice versa. Update the triangles (available in graphicsList) and return the updated ArrayList.
The Koch snow flake
It is created by dividing a triangle as illustrated by the following figures:
No division

After dividing one time,

After dividing one more time,

The method that creates the snow flake is
public ArrayList createASnowFlake ()
The number of divisions of the initial triangle can be anywhere between 0 and MAXIMUM_NUMBER_OF_DIVISIONS = 5. This number is given by the user. To do the input, use a dialog box (method readIntDialog in uwcse.io.Input). If the user gives an invalid value, display an error message (use JOptionPane.showMessageDialog) and ask for the entry again.
Start from the 3 points of the initial triangle. Then write a loop (that iterates as many times as there are divisions) to add more points to the figure. Store all of these points in an ArrayList and return that ArraryList. All of the points should be in sequence in the ArrayList.
Here are the formulas to add 3 points a, b and c, between two points p and q (you can just copy and paste):

Point a = new Point((int)(p.x + (q.x-p.x) / 3.0), (int)(p.y + (q.y-p.y)
/ 3.0));
Point c = new Point((int)(p.x + 2 * (q.x-p.x) / 3.0), (int)(p.y + 2 * (q.y-p.y)
/ 3.0));
Point b = new Point();
b.x = (int)(a.x + (c.x - a.x) * Math.cos(Math.PI / 3.0) + (c.y - a.y) * Math.sin(Math.PI
/ 3.0));
b.y = (int)(a.y - (c.x - a.x) * Math.sin(Math.PI / 3.0) + (c.y - a.y) * Math.cos(Math.PI
/ 3.0));
Note that the Point class doesn't allow you to set the color of a point. The first time the snow flake is drawn, it is black. But you can change its color with the method (called whenever the user clicks on the "Change colors" command button),
public Color changeColorOfSnowFlake()
In the method, just create a random color and return it (ViewWindow automatically updates the color of the snow flake accordingly).
What you need to do
Complete the class GraphicsElements. You need to provide exactly the interface listed in that class.
Sample code
As it is, the sample code shows the graphics window. Nothing happens when you clicks the radio buttons or the command buttons.
GraphicsElements.java, ViewWindow.java
Your program has to be your own.