I am programing a large calculus thing for my AP Calc teacher, and it's all going well, but it's quite big. Also, I've found that some people simply don't know wtf they are doing even though it's fairly self-explanitory. Anyway, I'm using PopUp and Dialog menus, and it's all working well, but to decide which program you use I'm using IF statements, and the problem is if I press ESC, it says undifined variable and it dies. How do I get the ESC key to be used as input? What do I put? My VOL program is below.
I realize that it's a huge frickin program and that I can optimize it a lot, but just haven't gotten around to that yet.
I am using a TI-89 Titanium
Code: ()
Prgm
Local v,e,a,b,r,dw,e1,e2,l,ss
PopUp {"Section","Shell"},ss
If ss=1 Then
PopUp {"Disk","Washer"},dw
If dw=1 Then
Dialog
Title "Parameters"
Request "Equation",e
Request "Left Limit",a
Request "Right Limit",b
DropDown "Rotation about",{"x","y","H line","V line"},r
EndDlog
expr(e)»e
expr(a)»a
expr(b)»b
If r=1 Then
·(Œ*e^2,x,a,b)»v
ElseIf r=2 Then
·(Œ*e^2,y,a,b)»v
ElseIf r=3 Then
Dialog
Title "Parameters"
Request "H. Line: y=",l
EndDlog
expr(l)»l
·(Œ*(l-e)^2,x,a,b)»v
ElseIf r=4 Then
Dialog
Title "Parameters"
Request "V. Line: x=",l
EndDlog
expr(l)»l
·(Œ*(l-e)^2,y,a,b)»v
EndIf
Disp [[v,approx(v)]]
ElseIf dw=2 Then
Dialog
Title "Parameters"
Request "Top Equation",e1
Request "Bottom Equation",e2
Request "Left Limit",a
Request "Right Limit",b
DropDown "Rotation about",{"x","y","H line","V line"},r
EndDlog
expr(e1)»e1
expr(e2)»e2
expr(a)»a
expr(b)»b
If r=1 Then
·(Œ*(e1^2-e2^2),x,a,b)»v
ElseIf r=2 Then
·(Œ*(e1^2-e2^2),y,a,b)»v
ElseIf r=3 Then
Dialog
Title "Parameters"
Request "H. Line: y=",l
EndDlog
expr(l)»l
·(Œ*((l-e1)^2-(l-e2)^2),x,a,b)»v
ElseIf r=4 Then
Dialog
Title "Parameters"
Request "V. Line: x=",l
EndDlog
expr(l)»l
·(Œ*((l-e1)^2-(l-e2)^2),y,a,b)»v
EndIf
Disp [[v,approx(v)]]
EndIf
ElseIf ss=2 Then
PopUp {"Disk","Washer"},dw
If dw=1 Then
Dialog
Title "Parameters"
Request "Equation",e
Request "Left Limit",a
Request "Right Limit",b
DropDown "Rotation about",{"y","x","V line","H line"},r
EndDlog
expr(e)»e
expr(a)»a
expr(b)»b
If r=1 Then
·(2*Œ*x*e,x,a,b)»v
ElseIf r=2 Then
·(2*y*Œ*e,y,a,b)»v
ElseIf r=3 Then
Dialog
Title "Parameters"
Request "H. Line: y=",l
EndDlog
expr(l)»l
·(2*Œ*(1-x)*e,x,a,b)»v
ElseIf r=4 Then
Dialog
Title "Parameters"
Request "V. Line: x=",l
EndDlog
expr(l)»l
·(2*Œ*(1-y)*e,y,a,b)»v
EndIf
Disp [[v,approx(v)]]
ElseIf dw=2 Then
Dialog
Title "Parameters"
Request "Top Equation",e1
Request "Bottom Equation",e2
Request "Left Limit",a
Request "Right Limit",b
DropDown "Rotation about",{"x","y","V line","H line"},r
EndDlog
expr(e1)»e1
expr(e2)»e2
expr(a)»a
expr(b)»b
If r=1 Then
·(2*Œ*x*(e1-e2),x,a,b)»v
ElseIf r=2 Then
·(2*Œ*y*(e1-e2),y,a,b)»v
ElseIf r=3 Then
Dialog
Title "Parameters"
Request "V. Line: x=",l
EndDlog
expr(l)»l
·(2*Œ*(l-x)*(e1-e2),x,a,b)»v
ElseIf r=4 Then
Dialog
Title "Parameters"
Request "H. Line: y=",l
EndDlog
expr(l)»l
·(2*Œ*(l-y)*(e1-e2),y,a,b)»v
EndIf
Disp [[v,approx(v)]]
EndIf
EndIf
EndPrgm
Last edited by Guest on 16 May 2006 09:38:21 am; edited 1 time in total |