Question: Write a program that acts as a simple printing calculator. The progren should allow the user to type in expressions of the form number operator


Write a program that acts as a simple printing calculator. The progren should allow the user to type in expressions of the form number operator The following operators should be recognized by the program + . . $ E The operator tells the program to set the accumulator" to the typed-in number. The E operator tells the program that execution is to end. The arithmetic operations are performed on the contents of the accumulator with the number that was keyed in acting as the second operand. The following is a "sample run" showing how the program should operate: Begin Calculations 10 S Set Accumulator to 10 - 10.000000 Contents of Accumulator 2/ Divide by 2 - 5.000000 Contents of Accumulator 35 - Subtract 35 -50.000000 100.25 Set Accumulator to 100.25 - 100.250000 4. Multiply by 4 - 401.000000 End of program = 401.000000 End of Calculations. Make certain that the program detects division by zero and also checks for unknown operators. Un the rural statement
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
