prepare a program that would allow the user to input the corners of a triangle. The program would draw small yellow circles for each input point, then draw the triangle and compute the perimeter and area of the triangle. The program will also draw the "mirror image" of the triangle, formed by swapping the x and y coordinates of each point. This is sometimes called the "reflection" of an object.
These actions would then be repeated 4 more times for triangles in different colors.
The equation for the perimeter is length of each of the three sides added together. Use the distance formula from Program 1 (it was used for finding the radius there).
The area of a triangle could be computed using these equations (a, b and c are the lengths of the three sides of the triangle):
The program must report the perimeter and area of each triangle and its reflection. It must also keep a total of each of those 2 measures and report the total when the program is about to end. The totals must include all triangles, including reflections. Note that the output samples also show a counter "Triangle 1", "Triangle 2", etc.
The list of colors it should use for triangles is ["red", "blue", "green", "pink", "black"].
• This program uses input from the mouse; remember to print the prompt to the user on the shell for the points.
• Use assignment statements to carry out the calculations, not output statements.
• You must use a for loop to control the color changes.
• Hint: make the triangle objects by using Polygon with 3 points as arguments.
• You should use at least one function from the math library.
• Obviously you should use several graphics functions.
• Do not forget to pause the program at the end and ask the user for a click, then close the graphics window.