| SOLUTION:
% variable declaration to list the variables used
% the name of the athlete is a string of characters and must be declared
as a string
var name : string
% the variables jump1, jump2, jump3, and average include decimal numbers
and must be declared as real
% numbers
var jump1, jump2, jump3, average : real
% a prompt to ask the athlete's name
put "Enter athlete's name"
get name:*
% retrieves and displays the name of the athlete (echoes it back)
put "the name of the athlete is ", name, "."
% a prompt to ask for the length of the first jump
put "the length of the first jump is"
get jump1
% a prompt to ask for the length of the second jump
put "the length of the second jump is"
get jump2
% a prompt to ask for the length of the third jump
put "the length of the third jump is"
get jump3
% display the information obtained by the user
put "the lengths of the jumps are ", jump1," ",jump2," ",jump3, " meters"
% calculate the average [jump1 + jump2 + jump3]/3
average := (jump1 + jump2 + jump3)/3
% display the average of the three jumps
put name," jumped an average of " , average, " meters".
The screenshot below shows the execution of the above program. |
| ASSIGNMENT: Write a program that will input
a student's name and his/her marks in three classes: English, Mathematics,
Science.
The program will then calculate the average, and finally output the
student's name and average mark.
NB: The average is calculated by
adding the three marks and dividing them by 3
The screenshot below shows the execution of the above program.

|