Programming Course for Beginners - ZedLX

The Easiest Online Computer Programming Course, for Free

Coordinate System Exercises [5/11]

This program draws three lines.

Exercise Coord 6-1 output image

Exercise: Draw a green disc centered on the intersection of the pink and the yellow line, also, the disc should touch the cyan line

Hint 1

First, you need to figure out what values should be assigned to the x and y coordinates of the green disc center.

Hint 2

The x coordinate of the green disc center must be equal to the distance from the pink line to the left side of the screen. Write this number down.

Hint 3

The y coordinate of the green disc center must be equal to the distance from the yellow line to the top of the screen. Write this number down.

Hint 4

Finally, you must figure out what should be the radius of the green disc.

Hint 5

The radius of the green disc must be equal to the distance between the pink line and the cyan line. Write this number down.

Solution

disc(190, 450, 300-190, /green);

Loading...