
Debugging a Program
Modifying an Existing Program to Create a New OneYou 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
Example: To create a program named “TETRA” that calculates the surface areas (cm2) and volumes (cm3) of three regular tetrahedrons, the lengths of whose sides are 7, 10, and 15 cm
A
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.
S = 3 A2, V = | 2 | A3 |
|
|
|
| |
| 12 |
|
|
|
|
| |
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 |
|
|
|
| |||
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).
uClassPad Operation
(1)On the application menu, tap p.
(2)Tap ~, or tap [Edit] and then [Open File].
20060301