Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Instructions
- Regular n-gons. Ngon_YI.java takes a command-line argument or from a Scanner object n and draws a regular n-gon using turtle graphics or StdDraw. By taking n to a sufficiently large value, we obtain a good approximation to a circle represented with polygons. Assume the polygon is inscribed in the circle.
- Show your images as n increases. The program Ngon_YI.java finds the smallest value for n to get the best approximation to a circle. Recursion is required for full credit. The input argument's purpose is to determine how many sides you want to start with.
- Explain clearly what your approach is in your documentation. This documentation is worth 25% of the assignment's grade.
- NOTE: you can use StdDraw or Turtle.
- To be clear your assignment is not complete unless you submit three parts:
- a. An animation showing how the polygon becomes a circle as the number of sides increases. This part does not require recursion.
- b. A recursive computation of the area of the polygon.
- c. Justify your final number of sides that approximate the area of the circle. You must showing explicitly why it is in fact the least number of sides.
- This site from Khan Academy might help you understand the general idea.
- https://www.khanacademy.org/partner-content/nasa/measuringuniverse/orbital-mechanics/a/discovering-pi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement