The program is:

SET COLOR "green"

PRINT "Hold down the mouse button and draw."

DO

GET MOUSE X,Y,S

LOOP UNTIL S = 1 ! mouse button is now clicked

DO WHILE S = 1

SET COLOR "red"

GET MOUSE X,Y,S ! a sequence of x,y points

PLOT X,Y; ! are generated

LOOP

PLOT x,y

DO

GET MOUSE X,Y,S

LOOP UNTIL S = 1 ! mouse button is now clicked

DO WHILE S = 1

SET COLOR "blue"

GET MOUSE X,Y,S ! a sequence of x,y points

PLOT X,Y; ! are generated

LOOP

PLOT x,y

DO

GET MOUSE X,Y,S

LOOP UNTIL S = 1 ! mouse button is now clicked

DO WHILE S = 1

SET COLOR "brown"

GET MOUSE X,Y,S ! a sequence of x,y points

PLOT X,Y; ! are generated

LOOP

plot x,y

DO

GET MOUSE X,Y,S

LOOP UNTIL S = 1 ! mouse button is now clicked

DO WHILE S = 1

SET COLOR "yellow"

GET MOUSE X,Y,S ! a sequence of x,y points

PLOT X,Y; ! are generated

LOOP

PLOT x,y

DO

GET MOUSE X,Y,S

LOOP UNTIL S = 1 ! mouse button is now clicked

DO WHILE S = 1

SET COLOR "magenta"

GET MOUSE X,Y,S ! a sequence of x,y points

PLOT X,Y; ! are generated

LOOP

PLOT x,y

PAUSE 3 !view the picture

END

The output is:

Hold down the mouse button and draw a colored line. Release the button, move the mouse and draw in a different color. Cross the boundary and come back with a different color. Check it out!