Programming Course for Beginners - ZedLX

The Easiest Online Computer Programming Course, for Free

Graph Drawing [6/9]

The provided source code is the solution of the previous exercise.

Open-ended exercise:

Waving Curve

1. Make a waving curve: Change the program so that first line ends are at coordinate y = 200*sin(i/70)+500 . Place the other line ends at y = 500 .
[Run the program]

The sin (sine) function can be used to create waves. Don't be afraid of the sine function, even if you don't know anything about it.

2. After you have made a waving curve, experiment with changing the literal numbers to produce various other waves. Change the numbers 200, 70 and 500 into some other numbers to see how it affects the shape of the wave. You can also try to find the number that produce a shape matching the one in the image below.

Waving curve exercise output image

Loading...