Question: JAVA Draw an Epicycloid graph based on the given integer values of s, a, b, and n, where b cannot be 0. Connect a line
JAVA
Draw an Epicycloid graph based on the given integer values of s, a, b, and n, where b cannot be 0. Connect a line between every two consecutive points (xi, yi) and (xi+1, yi+1), where 0
xi = s * ((a + b) * cos (i * PI) - b * cos ((a + b) / b * i * PI)) yi = s * ((a + b) * sin (i * PI) - b * sin ((a + b) / b * i * PI))
Verify with s = 10, a = 19, b = 5, n = 1000 to get this displayed result.
Note that the sin and cos trigonometry functions accept a radiant value not angle. For example, 30 degree should be replaced with PI/180*30 instead. Moreover, the divisions inside the functions need to be kept in double not int precision in order to render a correct result.
(hint: utilize the Math and Graphics classes)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
