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

Write a program that acts as a simple printing calculator.The program should allow the user to type in expressions of the following form: number operator The program should recognize the following operators: + - * / S E The S operator tells the program to set the accumulator to the typed-in number, and 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 55 - Subtract 55 = -50.000000 100.25 S Set Accumulator to 100.25 = 100.250000 4 * Multiply by 4 = 401.000000 0 E End of program = 401.000000 End of Calculations. Make sure that the program detects division by 0 and also checks for unknown operators. Use the Calculator class developed in Program 6.8 for performing your calculations. Note: Remember to use a space character in your scanf format string (e.g.,“%f %c”) to skip whitespace characters in the input.



May 26, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here