<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2668" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY style="COLOR: #000000; FONT-FAMILY: Times New Roman"
bgColor=#ffffff><LABEL id=HbSession SessionId="836161997"></LABEL>
<DIV>Hey all,</DIV>
<DIV> </DIV>
<DIV>The Giant Calculator runs now, just not as I want it to. I can't seem to
get it past the main menu. Here is the code:</DIV>
<DIV> </DIV>
<DIV># This program is designed as a big calculator with functions.</DIV>
<DIV> </DIV>
<DIV># This first bunch of code is for the various menus. I decided to divide
the calculations into seperate sub-menus,<BR>#so that the main menus would not
be that long.<BR>option = 0<BR>a = 0<BR>b = 0<BR>temp_option =
0<BR>formula_option = 0</DIV>
<DIV> </DIV>
<DIV>def main_menu():<BR> print "OPTIONS MENU"<BR> print
"1) Calculate"<BR> print "2) Shapes"<BR> print "3)
Temperature"<BR> print "4) Formulas"<BR> print "5)
Quit"<BR> option = input("What option would you like:" ) </DIV>
<DIV> </DIV>
<DIV>def cal_menu():<BR> print "CALCULATE
MENU"<BR> print "1) Add"<BR> print "2)
Subraction"<BR> print "3)
Multiplication"<BR> print "4) Division w/o
remainder"<BR> print "5) Division with
remaider"<BR> print "6) Exponation"<BR>
print "7) Square roots"<BR> print "8) Back to the previous
menu."<BR> a = input("What option would you like:" )</DIV>
<DIV> </DIV>
<DIV>def shape_menu():<BR> print "SHAPES
MENU"<BR> print "Important: The figure that is used for pi is
3.14."<BR> print "1) Squares"<BR> print "2)
Circles"<BR> print "3) Rectangles"<BR> print
"4) Triangles"<BR> print "5) Cones"<BR>
print "6) Cylinders"<BR> print "7)
Semicircles"<BR> print "8) Main menu"<BR> b
= input("What option would you like?" )</DIV>
<DIV> </DIV>
<DIV>def temp_menu():<BR> print "1) Convert degrees Kevins to
degrees Celsius"<BR> print "2) Contvert Fahrenheit to
Celsius"<BR> print "3) Convert Celsius to
Fahrenheit"<BR> print "4) Convert Celsius to
Kelvins"<BR> print "5) Convert Kelvins to
Fahrenheit"<BR> print "6) Convert Fahrenheit to
Kelvins"<BR> print "7) Main Menu"<BR>
temp_option = input("Choice: ")</DIV>
<DIV> </DIV>
<DIV>def formula_menu():<BR> print "1)
Interest"<BR> print "2) Distance"<BR> print
"3) Uniform motion"<BR> print "4)
Momentum"<BR> print "5) Uniformly accelerated
motion"<BR> print "6) Falling bodies"<BR>
print "7) Weight"<BR> print "8) Main
menu"<BR> fourmula_option = input("Choice: ")</DIV>
<DIV> </DIV>
<DIV>#Code for main part of program.<BR>print "The Giant
Calculator"<BR>print<BR>print "Copyright 2005 Written and debugged by Nathan
Pinno"<BR>print <BR>print main_menu()<BR>if option == 1:<BR>
print cal_menu()<BR> if a ==
1:<BR> X = input("First number:"
)<BR> Y = input("Second number:"
)<BR> print X, "+", Y, "= ",X +
Y<BR> print
cal_menu()<BR> elif a ==
2:<BR> X = input("First number:"
)<BR> Y = input("Second number:"
)<BR> print X, "-", Y, "= ",X -
Y<BR> print
cal_menu()<BR> elif a ==
3:<BR> X = input("First number:"
)<BR> Y = input("Second number:"
)<BR> print X, "*", Y, "= ",X *
Y<BR> print
cal_menu()<BR> elif a ==
4:<BR> X = input("First number:"
)<BR> Y = input("Second number:"
)<BR> if Y ==
0:<BR> print
"Division by zero ot
allowed!"<BR>
Y = input("Second number:" )<BR>
else:<BR>
print X, "/", Y, "= ",X /
Y<BR> print
cal_menu()<BR> elif a ==
5:<BR> X = input("First number:"
)<BR> Y = input("Second number:"
)<BR> if Y ==
0:<BR> print
"Division by zero ot
allowed!"<BR>
Y = input("Second number:" )<BR>
else:<BR>
print X, "/", Y, "= ",X / Y," R ", X %
Y<BR> print
cal_menu()<BR> elif a ==
6:<BR> X = input("First number:"
)<BR> Y = input("Power:"
)<BR> print X, "**", Y, "=
",X**Y<BR> print
cal_menu()<BR> elif a ==
7:<BR> X = input("Number to be
squared:" )<BR> print "The square root
of", X, " = ",X**0.5<BR> print
cal_menu()<BR> elif a ==
8:<BR> print
main_menu()<BR>
else:<BR> print "That's not an option.
Try again."<BR> a = input("What option
would you like:" )<BR>elif option == 2:<BR> print
shape_menu()<BR> if b ==
1:<BR> print "1)
Circumference"<BR> print "2)
Area"<BR> print "3) Shapes
Menu"<BR> op = input("Choice:
")<BR> if op ==
1:<BR> side =
input("Side:
")<BR> print
"Circumference =
",4*side<BR>
print shape_menu()<BR> elif op ==
2:<BR> side =
input("Side:
")<BR> print
"Area =
",side**2<BR>
print shape_menu()<BR> elif op ==
3:<BR> print
shape_menu()<BR>
else:<BR>
print "That's not an
option."<BR>
op = input("Choice: ")<BR> elif b ==
2:<BR> print "1)
Circumference"<BR> print "2)
Area"<BR> print "3) Shapes
Menu"<BR> d = input("Choice:
")<BR> if d ==
1:<BR>
diameter = input("Diameter:
")<BR> print
"The circumference of the circle is
",diameter*3.14<BR>
print shape_menu()<BR> elif d ==
2:<BR> radius
= input("Radius:
")<BR> print
"The area of the circle is
",3.14*(radius**2)<BR>
print shape_menu()<BR> elif d ==
3:<BR> print
shape_menu()<BR>
else:<BR>
print "That's not an
option."<BR> d
= input("Choice: ")<BR> elif b ==
3:<BR> print "1)
Area"<BR> print "2)
Perimeter"<BR> print "3) Main
menu"<BR> g = input("Choice:
")<BR> if g ==
1:<BR> base =
input("Base:
")<BR>
altitude = input("Altitude:
")<BR> print
"The area of the rectangle is:
",base*altitude<BR>
print shape_menu()<BR> elif g ==
2:<BR> base =
input("Base:
")<BR>
altitude = input("Altiutude:
")<BR> print
"The perimeter of the rectangle is:
",(2*base)+(2*altitude)<BR>
print shape_menu()<BR> elif g ==
3:<BR> print
shape_menu()<BR>
else:<BR> print
"That's not an
option."<BR> g =
input("Choice: ")<BR> elif b ==
4:<BR> print "1) Right Triangles -
Pygathorean Theorum"<BR> print "2)
Perimeter"<BR> print "3)
Area"<BR> print "4) Shapes
Menu"<BR> e = input("Choice:
")<BR> if e ==
1:<BR> sidea =
input("Side A:
")<BR> sideb =
input("side B:
")<BR> print
"The hypotenuse's length is:
",((sidea**2)+(sideb**2))**0.5<BR>
print shape_menu()<BR> elif e ==
2:<BR> sidea =
input("Side A:
")<BR> sideb =
input("Side B:
")<BR> sidec =
input("Side C:
")<BR> print
"The Perimeter of the triangle is:
",sidea+sideb+sidec<BR>
print shape_menu()<BR> elif e ==
3:<BR> base =
input("Base:
")<BR> height
= input("Height:
")<BR> print
"The area of the triangle is:
",1/2*base*height<BR>
print shape_menu()<BR> elif e ==
4:<BR> print
shape_menu()<BR>
else:<BR>
print "That's not an option! Try
again."<BR> e
= input("Choice: ")<BR> elif b ==
5:<BR> print "The base and
circumference of a cone can be found with the circle formulas, so they aren't
found here."<BR> print "1) Lateral
Area"<BR> print "2) Total
Area"<BR> print "3)
Volume"<BR> print "4) Shapes
Menu"<BR> opt = input("Choice:
")<BR> if opt ==
1:<BR> r =
input("Radius:
")<BR> sl =
input("Slant height:
")<BR> print "The
Lateral Area is:
",1/2*(2*3.14*r)*sl<BR>
print shape_menu()<BR> elif opt ==
2:<BR> r =
input("Radius:
")<BR> sl =
input("Slant height:
")<BR> print "The
total area is:
",1/2*(2*3.14*r)*sl+(3.14*(r**2))<BR>
print shape_menu()<BR> elif opt ==
3:<BR> height =
input("Height:
")<BR> r =
input("Radius:
")<BR> print "The
volume is:
",1/4*(3.14*(r**2))*height<BR>
print shape_menu()<BR> elif opt ==
4:<BR> print
shape_menu()<BR>
else:<BR> print
"That's not an
option"<BR> opt =
input("Choice: ")<BR> elif b ==
6:<BR> print "1) Lateral
Area"<BR> print "2) Total
Area"<BR> print "3)
Volume"<BR> print "4) Shape
Menu"<BR> g = input("Choice:
")<BR> if g ==
1:<BR> r =
input("Radius:
")<BR> height =
input("Height:
")<BR> print "The
Lateral Area is:
",(2*3.14*r)*height<BR>
print shape_menu()<BR> elif g ==
2:<BR> r =
input("Radius:
")<BR> height =
input("Height:
")<BR> print "The
Total Area is:
",((2*3.14*r)*height)+(2*(3.14*(r**2)))<BR>
print shape_menu()<BR> elif g ==
3:<BR> r =
input("Radius:
")<BR> height =
input("Height:
")<BR> print "The
volume is:
",(3.14*(r**2))*height<BR>
print shape_menu()<BR> elif g ==
4:<BR> print
shape_menu()<BR>
else:<BR> print
"That is not an
option!"<BR> g =
input("Choice: ")<BR> elif b ==
7:<BR> print "1) Arc
Length"<BR> print "2)
Area"<BR> print "3) Shape
Menu"<BR> h = input("Choice:
")<BR> if h ==
1:<BR> diam =
input("Diameter:
")<BR> print "The
arc length is:
",(3.14*diam)/2<BR>
print shape_menu()<BR> elif h ==
2:<BR> r =
input("Radius:
")<BR> print "The
area is:
",(3.14*(r**2))/2<BR>
print shape_menu()<BR> elif h ==
3:<BR> print
shape_menu<BR>
else:<BR> print
"Sorry, incorrect entry. Please try
again."<BR> h =
input("Choice: ")<BR> elif b ==
8:<BR> print
main_menu()<BR>
else:<BR> print "Sorry, not an
option."<BR> print
shape_menu()<BR>elif option == 3:<BR> print
temp_menu()<BR> if temp_option ==
1:<BR> print "Convert degrees Kelvin
to degrees Celsius."<BR> k =
input("Degrees Kelvin: ")<BR> print
k-273.16," degrees Celsius"<BR> print
temp_menu()<BR> elif temp_option ==
2:<BR> print "Convert Fahrenheit to
Celsius"<BR> f = input("Degrees Fahrenheit:
")<BR> print 5/9*(f-32)," degrees
Celsius"<BR> print
temp_menu()<BR> elif temp_option ==
3:<BR> print "Convert Celsius to
Fahrenheit"<BR> c = input("Degrees Celsius:
")<BR> print (9/5*C)+32," degrees
Fahrenheit"<BR> print
temp_menu()<BR> elif temp_option ==
4:<BR> print "Convert degrees Celsius to degrees
Kelvin"<BR> c = input("Degrees Celsius:
")<BR> print c+273.16," degrees
Kelvin"<BR> print
temp_menu()<BR> elif temp_option ==
5:<BR> print "Convert degrees Kelvin to
Fahrenheit"<BR> k = input("Degrees Kelvin:
")<BR> print ((k-273.16)*9/5)+32," degrees
Fahrenheit"<BR> print
temp_menu()<BR> elif temp_option ==
6:<BR> print "Convert Fahrenheit to degrees
Kelvin"<BR> f = input("Degrees Fahrenheit:
")<BR> print (5/9*(f-32))+273.16," degrees
Kelvin"<BR> print
temp_menu()<BR> elif temp_option ==
7:<BR> print main_menu()<BR>
else:<BR> print "That's not an option. Please try
again"<BR> print temp_menu()<BR>elif option ==
4:<BR> print formula_menu()<BR> if formula_option ==
1:<BR> p = input("Principal:
")<BR> r = input("Rate as a decimal:
")<BR> t = input("Time in years:
")<BR> print "Interest:
",p*r*t<BR> print formula_menu()<BR>
elif formula_option == 2:<BR> r = input("Rate:
")<BR> t = input("Time:
")<BR> print "Distance:
",r*t<BR> print formula_menu()<BR>
elif formula_option == 3:<BR> v = input("Velocity:
")<BR> t = input("Time:
")<BR> print "Uniform motion:
",v*t<BR> print formula_menu()<BR>
elif formula_option == 4:<BR> m = input("Mass:
")<BR> v = input("Velocity:
")<BR> print "Momentum:
",m*v<BR> print formula_menu()<BR>
elif formula_option == 5:<BR> as =
input("Acceleration speed: ")<BR> t = input("Time:
")<BR> print "Uniformly accelerated motion:
",1/2*as*t<BR> print
formula_menu()<BR> elif formula_option ==
6:<BR> gravity = input("Constant acceleration due
to gravity: ")<BR> t = input("Time:
")<BR> print "Distance covered by falling body:
",1/2*gravity*(t**2)<BR> print
formula_menu()<BR> elif formula_option ==
7:<BR> m = input("Mass:
")<BR> gravity = input("Gravity:
")<BR> print "Weight:
",m*gravity<BR> print
formula_menu()<BR> elif formula_option ==
8:<BR> print main_menu()<BR>
else:<BR> print "That is not an
option."<BR> print formula_menu()<BR>elif option
== 5:<BR> print "Goodbye!"<BR>else:<BR> print "That is
not an option. Please choose an option from the menu."<BR> print
main_menu()<BR>print<BR></DIV>
<DIV>Any help will be appreciated!</DIV>
<DIV>Nathan Pinno<BR><A
href="http://www.npinnowebsite.ca/">http://www.npinnowebsite.ca/</A></DIV>
<P></P></BODY></HTML>