Programming Course for Beginners - ZedLX

The Easiest Online Computer Programming Course, for Free

Simple Graphics [2/15]

The given program contains an error.

It is impossible for the automatic verifier to always find out what exactly is wrong. This is such a case, and the error report is not very helpfull.

Some exercises must be difficult. If all of them could just be easily solved, 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:

1. Try to correct the error.

Inside an expression, a forward slash symbol denotes a division operation. Therefore, 20 /darkorange means: 20 divided by “darkorange”, which makes no sense.

Hint: the arguments must be separated by a comma (,).

If you are unable to solve an exercise, then it is fine to look at the solution. But, be sure to make a good effort. In this exercise, try reading the provided hint again.

Solution

    disc(x, 200, 20, /darkorange);

[Run the program]

2. Insert the statement println "x: ", x; just above the disc statement.
[Run the program]

Loading...