238 Chapter 12: Programming
7312ENG.DOC CH 12 Programming, English Julie Hewlett Revised: 07/29/98 12:17 PM Printed: 05/19/99 9:02
AM Page 238 of 32
Write a program named SETMENU that displays a menu of
animal weights. Label the title WEIGHTS, show weight values
of five different animals, and allow the user to change the
weight values.
PROGRAM:SETMENU
:SetMenu("WEIGHTS","AARDVARK",
A,"ELEPHANT",B,"ARMADILLO",
C,"MONKEY",D," KANGAROO",E)
prgm prgm 8
E E
Use prgm to execute other programs as subroutines. When you
select prgm, it is pasted to the cursor location. Use the Text
editor to enter the characters needed to spell a program name.
Using prgm is equivalent to selecting existing programs from
the 8 EXEC menu (see the section in this chapters entitled
Calling a Program from Another Program; however, it
allows you to enter the name of a program that you have not
yet created.
:prgmname
Write two programs named CALCAREA and VOLUME. CALCAREA
calculates the area of a circle. VOLUME inputs the circle
diameter D, and height H, calls CALCAREA as a subroutine,
which calculates the area using D and H, and then displays the
volume of a cylinder .
³
³
A, B, and C
were previously
defined.
For example, the
ARMADILLO's weight is
assigned to variable C.
Enter new
weights.