20021201
Modifying an Existing Program to Create a New One
You can use the procedure described below to recall an existing program, modify it, and then
run the result as a new program. This helps reduce key input requirements.
The following shows how to modify the “OCTA” program we created on page 12-2-1 to
handle tetrahedrons.
Example:
To create a program named “TETRA” that calculates the surface areas (cm
2
) and
volumes (cm
3
) of three regular tetrahedrons, the lengths of whose sides are 7, 10,
and 15 cm
The following formulas calculate the surface area S and volume V of a
regular tetrahedron for which the length of one side A is known.
The following is the program required for this example.
Length of One Side A ........ Input A
Surface Area S .................. Print approx(
(3)
×
A^2)
Volume V ........................... Print approx(
(2)
÷
12
×
A^3)
The following is the “OCTA” program (page 12-2-1).
Length of One Side A ........ Input A
Surface Area S .................. Print approx(2
×
(3)
×
A^2)
Volume V ........................... Print approx(
(2)
÷
3
×
A^3)
A comparison of the two programs indicates that the following modifications of the “OCTA”
program will produce a program that performs the calculations required by this example.
• Delete “2
×
” (underlined with a wavy line above).
• Change 3 to 12 (underlined with double lines above).
u
ClassPad Operation
(1) On the application menu, tap
p
.
(2) Tap
~
, or tap [Edit] and then [Open File].
12-3-2
Debugging a Program
2
S = 3 A
2
,
V = –––– A
3
12
A