Programming Course for Beginners - ZedLX

The Easiest Online Computer Programming Course, for Free

Coordinate System Exercises [1/11]


Coordinate System Exercises

First, run the accompanying demonstrational program. Demonstrational programs are not explained in detail.

This program draws a growing disc. At the start of the program, the center of the disc is at the middle of the screen, but you can move the disc around by using a mouse or touch.

The position of the disc's center is given by the coordinates x and y. The program makes the coordinates change as you move the mouse around. The disc and the accompanying items are then redrawn according to the position given by the coordinates x and y.

  • The x coordinate specifies the distance from the left side of the screen.
  • The y coordinate specifies the distance from the top of the screen.

The radius is the distance from the disc center to the disc edge. The radius equals half the disc size. The disc size is called the diameter. The diameter always equals twice the radius.

Exercise:

Use this program to find out the maximum x and y coordinates. The maximum coordinates describe the size of the output image.

Solution

The size of the output screen can be figured out by holding down the left mouse button while the program is running and moving the mouse into the bottom-right corner of the screen. The maximum x-coordinate equals 960; the maximum y-coordinate equals 720.

Click on the 'Next' button (at the top of the page) to proceed.

Loading...