Due: Thursday 10/10 10:00am

Submission name: w14_graphs

For this assignment, you may want to refer to:

Write the following functions:

  • getSineY(int theta, float amplitude, int k)
    • Returns the y value given:
      • \[y = amplitude\sin(\theta) + k\]
    • Assume theta represents a measure in degrees.
  • drawSineCurve(int x, float amplitude, int k, int d)
    • Calls getSinY, using x as the value for theta.
    • Draws a dot of diameter d with the center of (x, getSineY...)
  • plotCircle(int theta, int r, int cx, int cy, int d)
    • Draws a dot of diameter d at (x, y) where (x, y) is a point on the circumference of a circle with center (cx, cy) and radius r.
    • Remember your algebra:
      • \[x = amplitude\cos(\theta) + cx\]
      • \[y = amplitude\sin(\theta) + cy\]

Write a program with setup and draw to test these functions:

  • Create a 600x600 screen.
  • In draw use the current frame for theta.
  • Have the sine curve wrap back to the left side of the screen when it reaches the right edge.
  • Use the top half of the screen for the since curve.
  • Use the bottom half of the screen for the circle.