1. Sierpinski A Sierpinski triangle is a recursive structure of triangles within triangles. The order of the Sierpinski

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

1. Sierpinski A Sierpinski triangle is a recursive structure of triangles within triangles. The order of the Sierpinski

Post by answerhappygod »

1. Sierpinski
A Sierpinski triangle is a recursive structure of triangleswithin triangles. The order of the Sierpinskitriangle refers to how many levels of nested triangles to draw.There is one outer triangle that points upward. Then we can draw adownward facing triangle within it. This then creates three newupward facing triangles (above, left, and right of the downwardone), in which we can repeat this process. For example:
Write a program that takes the order as a command-line argument(e.g., java Sierpinski 2) and draws the correspondingSierpinski triangle. You can use Sierpinski.java as astarting point. Your program should use recursion. Due to integerrounding, your images might look slightly different than thoseabove.
To draw a triangle, you may want to usethe g.drawPolygon(xs, ys, n) method,where xs is a list of x-coordinates, ys a listof y-coordinates, and n the number of vertices.
Please submit and java and provide a screenshot of theoutput.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply