Assignment #3
You are given FOUR program codes with no comments and no explanation as to what they do.
For each code you are asked to
| a) compile and run the program b) explain what the program does step-by-step c) insert comments (using the "%" symbol) before each line of code to explain what the significance of the line is. c) add any other commands to improve or make the program more user friendly. d) modify each program to customize it to your liking (i.e. change colours, numbers....) |
A. Program 1
setscreen ("graphics:vga")
drawmapleleaf (300, 200, 340, 280, 9)
B. Program 2
setscreen ("graphics:vga")
drawstar (250, 250, 350, 350, 5)
C. Program 3
var base, height, area : REAL
get base
get height
area := 0.5*base*height
put area
D. Program 4
for counter : 1 .. 30
put counter : 6, counter**2 : 7, counter**3 : 8
end for