Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2 Sierpinski's Triangle (30 points) Sierpinski's Triangle is a simple and famous example of a fractal image. It is built recursively from a simple set
2 Sierpinski's Triangle (30 points) Sierpinski's Triangle is a simple and famous example of a fractal image. It is built recursively from a simple set of rules, illustrated in Ligure 2. Your task will be to create an application that illustrates a perfect. Sierpinski triangle, regardlews of how large the application frame is. As the iser moves and resizes the application window, the triangle should be redrawn and made larger or smaller s appropriate. Your program should display a frame that is based on the size of the user's screen. The paint Component method of the panel on which yon are drawing will be called whenever the frame is resized, so that happens antomagically ad you don't have to worry abont it. JlPanels include a get Height() and get Width() method that yo will be able to use to get the information you need for pssing to a recuve draw function that you will write The draw algorithm takes the coordinates and dimensions of a square area of the screen inpmt. If that square is the size of a single pixel, it should call drawRect() on the Graphics object passed into paintComponent, drawing a one pixel square at the given coordinates. If larger, it should call the draw method three times recursively, once on the lower left quadrant of the square once on the lower right, and once on an area centered above the other two (as illustrated in Figure
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started