Write a program tosimulate hand-held electronic calculator. Your program shoulde
ID: 3612940 • Letter: W
Question
Write a program tosimulate hand-held electronic calculator. Your program shouldexecute as follows:• Step 1: display a prompt and wait for the user to enter aninstruction code (a single character):
‘+’ for addition
‘-‘ for subtraction
‘*’ for multiplication
‘/’ for division
‘p’ for power
‘c’ to clear the current accumulator
‘s’ for square root
‘l’ for log
‘n’ for ln
‘q’ for quit
• Step 2: (if needed) display a prompt and wait for the userto enter a type float number (which we will call left-operand)
• Step 3: (if needed) display a prompt and wait for the userto enter a type float number (which we will call right-operand)
• Step 4: display the accumulated result at any point duringprocessing and repeat steps 1 through 3 using a GOTO statement (noloops in this assignment).
Use a separate function enter_code to prompt the user forinstruction code and to ensure that a valid code is entered. Also,use a separate function enter_operand for the entry of theleft-operand and the right-operand. Finally, use another functioncompute to perform the indicated operation. (unless q wasentered).
Write a program tosimulate hand-held electronic calculator. Your program shouldexecute as follows:
• Step 1: display a prompt and wait for the user to enter aninstruction code (a single character):
‘+’ for addition
‘-‘ for subtraction
‘*’ for multiplication
‘/’ for division
‘p’ for power
‘c’ to clear the current accumulator
‘s’ for square root
‘l’ for log
‘n’ for ln
‘q’ for quit
• Step 2: (if needed) display a prompt and wait for the userto enter a type float number (which we will call left-operand)
• Step 3: (if needed) display a prompt and wait for the userto enter a type float number (which we will call right-operand)
• Step 4: display the accumulated result at any point duringprocessing and repeat steps 1 through 3 using a GOTO statement (noloops in this assignment).
Use a separate function enter_code to prompt the user forinstruction code and to ensure that a valid code is entered. Also,use a separate function enter_operand for the entry of theleft-operand and the right-operand. Finally, use another functioncompute to perform the indicated operation. (unless q wasentered).