Advertisement
Arbitrator

Untitled

Oct 5th, 2019
6,855
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. Instructions
  2.  
  3. 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.
  4.  
  5. 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.
  6.  
  7. Explain clearly what your approach is in your documentation. This documentation is worth 25% of the assignment's grade.
  8.  
  9. NOTE: you can use StdDraw or Turtle.
  10.  
  11. To be clear your assignment is not complete unless you submit three parts:
  12.  
  13. a. An animation showing how the polygon becomes a circle as the number of sides increases. This part does not require recursion.
  14.  
  15. b. A recursive computation of the area of the polygon.
  16.  
  17. 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.
  18.  
  19. This site from Khan Academy might help you understand the general idea.
  20. https://www.khanacademy.org/partner-content/nasa/measuringuniverse/orbital-mechanics/a/discovering-pi
  21.  
  22.  
  23. REOURCEs:
  24. https://introcs.cs.princeton.edu/java/stdlib/
  25. https://introcs.cs.princeton.edu/java/32class/Ngon.java.html
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement