Post Reply 
(50g) Moment of Inertia
06-24-2014, 02:48 AM
Post: #1
(50g) Moment of Inertia
Source:

Browne, Michael E. Ph. D "Schaum's Outlines: Physics for Engineering and Science" 2nd. Ed McGraw Hill: New York. 2010.

HP 50g: INERTIA

6/23/2014

Code:

<< 1 1 1 1 1 
→ c a b m r 
<< "Moment of Inertia"
{ { "Square" 1 }
{ "Rectangle" 2 }
{ "Cylinder" 3 }
{ "Sphere" 4 }
{ "Hoop" 5 } }
1 CHOOSE

IF 0 == THEN KILL END 

'c' STO

CASE c 1 == THEN
"m" PROMPT "a" PROMPT 
SQ * 6 / END

c 2 == THEN
"m" PROMPT "a" PROMPT SQ 
"b" PROMPT SQ + * 12 / END

c 3 == THEN
"m" PROMPT "r" PROMPT SQ * 
2 / END

c 4 == THEN
"m" PROMPT "r" PROMPT SQ * 2 *
5 / END

c 5 == THEN 
"m" PROMPT "r" PROMPT SQ * 
END

END >> >>

Notes:
* I just stored a value in the variables c, a, b, m, and r, and used the right arrow ( → ) to make the variables local.
* The IF 0 == THEN KILL END sequence handles the case the user chooses CANCEL over its options.
* The consecutive PROMPT commands saved space instead of using INFORM.
* INERTIA demonstrates the CASE structure
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)