(a)
Define each of the following terms:
(i)
Variable;
(ii)
Constant.
(b)
Differentiage between a variable and a constant.
(c)
State one advantage of using variable over a constant;
(d)
State one advantage of using a constant over a variable;
A programmer is building a tennis game that will be played by multiple players by controlling the racket.
State the data types she may use to represent each of the following information and the reason for each choice:
(i)
Name of player;
(ii)
Phone number of player;
(iii)
Age of player;
(iv)
Gender of player;
(v)
Score of player;
(vi)
The x and y coordinates of the ball;
(vii)
The speed of the ball;
(viii)
The x and y coordinates of the racket;
(ix)
Whether the racket has collided with the ball or not.
Write the name you will give to a memory location to store the following information:
(i)
The constant π;
(ii)
The number of students in the class;
(iii)
The temperature in degrees Celsius;
(iv)
The name of a student;
(v)
The grade of a student;
(vi)
Circumference of a circle;
(vii)
Date of birth;
(viii)
Color of eyes;
(ix)
X position of a ball;
(ix)
Y position of a ball.