8/14/2014Recursive Graphics Assignment1/4COS 126Recursive GraphicsProgramming AssignmentWrite a program that plots a Sierpinski triangle, as illustrated below. Then, develop a program that plots a recursive pattern of your own design.Part 1.TheSierpinski triangleis another example of a fractal pattern like the H-tree pattern from Section 2.3 of the textbook. The Polish
8/14/2014Recursive Graphics Assignment2/4mathematician Wacław Sierpiński described the pattern in 1915, but it has appeared in Italian art since the 13th century. Though the Sierpinski trianglelooks complex, it can be generated with a short recursive program. Your task is to write a programSierpinski.javawith a recursive functionsierpinski()and amain()function that calls the recursive function once, and plots the result using standard drawing. Think recursively:sierpinski()should draw one filled equilateral triangle (pointed downwards) and then call itself recursively 3 times (with an appropriate stoppingcondition). When writing your program, exercise modular design: include a (non-recursive) functionfilledTriangle()that draws a filled equilateraltriangle of a specified size at a specified location.