The following program, VSPH, calculates the volume of a sphere. VSPH prompts for the radius of the sphere, then cubes it and multiplies by 4/3 π. VSPH executes INPUT to prompt for the radius. INPUT sets Programentry mode when program execution pauses for data entry.

Program:

Comments:

 

 

«

 

"Key in radius"

Specifies the prompt string.

""

Specifies the commandline string.

 

In this case, the command line will be

 

empty.

INPUT

Displays the prompt, puts the cursor at

 

the start of the command line, and

 

suspends the program for data input

 

(the radius of the sphere).

OBJ→

Converts the result string into its

 

component object — a real number.

3 ^

Cubes the radius.

4 * 3 / π * →NUM

Completes the calculation.

»

 

 

 

`OVSPH

Stores the program in VSPH.

 

 

Example:

Execute VSPH to calculate the volume of a sphere of radius 2.5.

J%VSPH%

Key in the radius and continue program execution. 2.5 `

RPL Programming 141

Page 65
Image 65
HP 48gII Graphing, 50g Graphing manual Vsph%