This problem is really tough. Its actually 2 problems but they are related. The second one uses the.

This problem is really tough. Its actually 2 problems but they are related. The second one uses the program built in the first one and basically turns it into a Graphical User Interface. If you accept and are able to complete this, I will be sure to leave a very nice bonus. I need to the final product to include a .java file and a class file for each problem. thanks!* Create a Java program based on the geometric shapes example described at the beginning of this lesson using Classes Square, Triangle, Rectangle, and Circle to help describe inheritance and polymorphism using the circumference() method. The program will calculate the circumference of a designated shape.* The program should begin by prompting you for the shape you want to calculate the circumference for – square, rectangle, circle, or triangle. You can designate 1-square, 2-rectangle, 3-circle, 4-triangle, and 5-Exit.* Once you select your shape, then the program should prompt you for enough information to calculate the circumference of the chosen shape. For example, if you select square then the program should prompt you for the length of one side of the square. If you select circle, then the program will prompt you for either the radius or diameter of the circle. With the information for calculating the circumference, have the program complete the calculation and print the information to the screen, using one of the JOptionPane output classes (methods) or any other graphical output method.Your output should look something like this:* You selected SquareLength of each side=XX.X cm (centimeters — do all measurements in metric)Area=XX.X cmo Make sure you create the program in a loop and have the program prompt you for another shape and calculation. Enter 5 for exit.o You should first create a Square superclass, and then from it create Rectangle, Circle, and Triangle subclasses. In the Square class create a circumference() method (e.g., circumf()) and then re-define that method in each subclass to calculate the area of the appropriate shape.o You should also create a color() method (e.g., color()) and have the Square superclass return the color as white. Have each subclass also return color, but redefine the color method in the Circle subclass to return the color as blue.o Also, you should now be using the JOptionPane.showMessageDialog() method for displaying your output instead of System.out.println().Note: Make sure you create a float constant for the value ofpi=3.14159 in your Circle class.—————————————————–This is a separate assignment (assignment 2) but it uses the program built in the previous assignment. using the assignment above, turn it into a GUI application.* When a shape is selected and the size of the parameters (i.e., sides, diameter, radius, etc.) is given draw the image using that information. For example, if you specify a square with sides that are 4 cm, draw a square with sides that are 4 cm in size. You will need to place limits on the parameters you can specify to make sure the images will fit on your screen.* Use the drawString() method to display the circumference calculated from each shape.