Programming Course for Beginners - ZedLX

The Easiest Online Computer Programming Course, for Free

Overconfidence Anhilator [3/4]

[Run the program; restart it a few times]

Some exercises must be difficult. If all of them could just be easily solved by everyone, then the exercises would be boring, and they would lack educational value. A lot can be learned from a difficult exercise, escpecially when the solution is peeked at only after a few minutes of sincere effort.

Exercise:

Excercise 3 output: a horizontal line with a circle above it touching top of the screen and the line and a circle below the line touching the top of the screen and the line

(Challenging!) Add a circle that touches the bottom of the screen and the line, and is centered on the middle column. The screen is 720 pixels high.

If you think you have a correct solution, remember to restart it a few times to verify it works correctly.

Hint 1

On a piece of paper, write down a formula for calculating the diameter of the bottom circle. Then, the radius is equal to half of the diameter.

Then, if the radius of the bottom circle is known, write down a formula for calculating the y-coordinate of the circle center.

Hint 2

To produce a formula for the diameter of the bottom circle, think: what is the bottom circle bounded by?

Hint 3

Don't guess, THINK!

If you fail to solve this task, click on the Next > button to proceed.

Loading...