### Overconfidence Anhilator

Let the variable y equal a random whole number in the range 1–707.

### Exercise:

Draw a horizontal line at the distance y from the top of the screen. The screen is 960 pixels wide.

To verify that your program works as intended, restart it a few times.

The solution is on the next slide.

As a solution of the previous exercise,
the given program draws a horizontal line at a random distance
from the top of the screen. Run and restart the program a few times.

### Exercise:

Add a circle that touches the top of the screen and the line, and is centered on the middle column.

Restart your solution a few times to verify that it works correctly.

The solution is on the next slide.

[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:

(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?

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

You couldn't solve it, right?

That's OK.

The real issue is that learning to program is much harder than it appears to be.

Programming becomes easy in time, but only after learning and practicing.
A common programmer is able to solve the previous task in less than three minutes.
In fact, programmers are so accustomed to solving such tasks,
that they fail to notice the difficulty.
Solving programming problems becomes so natural to them that they completely forget
how hard it was when they were first starting to program.

Learning to program takes a lot of time. On the other hand, if you can make
yourself work through a few chapters of this tutorial each week, you will be done in no time.

So, keep on learning!

The solution will not be provided.
Click on the 'Articles'
button at the top to select another article.
We also suggest taking a peak into our main 'Gallery' of programs,
and taking a look into 'Overview'
of our main programming tutorial for beginners.
Have fun!