Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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).

Explanation / Answer

please rate - thanks you didn't say no else, and no switch so I used those, I can changeit to not use those also. I would have used an array to checkthe operators, but you said no loops #include #include using namespace std; float compute(float,float,char); float enter_operand(int); char enter_code(); int main() {float num1, num2,accum; char oper; loop:      oper=enter_code();      if(oper=='q')          return 0;      if(oper!='c')         num1=enter_operand(1);     if(oper=='+'||oper=='-'||oper=='*'||oper=='/'||oper=='p')         num2=enter_operand(2);      accum=compute(num1,num2,oper);      cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote