Tech Support banner

Status
Not open for further replies.
1 - 1 of 1 Posts

·
Registered
Joined
·
1 Posts
Discussion Starter #1 (Edited)
I'm programming a caclulator with the ability to carry out addition, subtraction, modulus, division, and multiplication. I've got all of the functions correct I just need help with the MENU SYSTEM! I have it displayed: 1.Addition 2.Subtraction 3.Division 4.Multiplication 5.Modulus and it seems that my "if" statements aren't working because no matter what value(1-5) I insert it gives me the Addition program. I'll insert my program in text. Please, I know this is probably really easy to resolve so if someone could just edit my program to get it working correctly it would be a HUGE help. BTW, I have indented under my "if"s it just doesn't show up on the forum page.

Name = raw_input("Enter Your Name:")
print "Hello,",Name,". Welcome to Max's Calculator"



print "1.Addition 2.Subtraction 3.Division 4.Multiplication 5.Modulus"
menuchoice = raw_input("Make your selection:")


if menuchoice != 1:
menuchoice = integer1 = raw_input( "Enter first integer: \n")
integer1 = int(integer1)

integer2 = raw_input( "Enter second integer: \n")
integer2 = int(integer2)

print "User:",Name

print "Operation: Addition"

sum = integer1 + integer2

print "Sum is\a ", sum

if menuchoice != 2:
menuchoice = integer1 = raw_input( "Enter integer to be subtracted from: \n")
integer1 = int(integer1)

integer2 = raw_input( "Enter integer being subtracted: \n")
integer2 = int(integer2)

difference = integer1 - integer2

print "User:",Name

print "Operation: Subtraction"

print "Difference is\a ",difference

if menuchoice != 3:
integer1 = raw_input( "Enter Number to be divided: \n")
integer1 = int(integer1)

integer2 = raw_input( "Enter Number to divide by: \n")
integer2 = int(integer2)

quotient = integer1 / integer2

print "User:",Name

print "Operation: Division"

print "Quotient is\a ",quotient

if menuchoice != 4:
integer1 = raw_input( "Enter first multiplication integer: \n")
integer1 = int(integer1)

integer2 = raw_input( "Enter integer to multiply by: \n")
integer2 = int(integer2)

product = integer1 * integer2

print "User:",Name

print "Operation: Multiplication"

print "Product is\a ",product

if menuchoice != 5:
integer1 = raw_input( "Enter first integer: \n")
integer1 = int(integer1)

integer2 = raw_input( "Enter second integer: \n")
integer2 = int(integer2)

Result = integer1 % integer2

print "User:",Name

print "Operation: Modulus"

print "Result is\a",Result
 
1 - 1 of 1 Posts
Status
Not open for further replies.
Top