A calculator is an electronic device that is used to perform arithmetic operations like addition, subtraction, multiplication, division, etc. You are requested to develop an embedded software of a calculator with following specifications: a. This program takes an arithmetic operator (+, -, *, /) and two operands as the input. b. It also checks whether the user wants to quit the program, if yes then terminate the program execution. For this, you can use a special character and tell the user about it, like here we used "X". C. The arithmetic operation is performed based on the operator and two operands inserted by user in (a). d. Display the complete arithmetic operation which includes the 2 operands, the arithmetic operator, and the computation result. Figure 5 shows samples of expected program execution output display for your reference in solution development. Enter an operator (+, -, *, /) or 'x' to exit: + Enter two operands: 7.3 8.9 7.30 +8.90 = 16.20 Enter an operator (+, -, *, /) or 'x' to exit: - Enter two operands: 8.5 12.34 8.50 12.34 = -3.84 Enter an operator (+, -, *, /) or 'x' to exit: * Enter two operands: 1.5 100 1.50 100.00 = 150.00 Enter an operator (+, -, *, /) or 'x' to exit: / Enter two operands: 8 3 8.00/3.00 = 2.67 Enter an operator (+, -, *, /) or 'x' to exit: x Exit the program! Figure 5 1. Sketch a flowchart which provides solution according to the given specification and requirement. 2. Based on your flowchart, derive the complete C code to deliver the simple calculator.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter5: Control Structures Ii (repetition)
Section: Chapter Questions
Problem 27PE
icon
Related questions
Question
A calculator is an electronic device that is used to perform arithmetic operations like addition, subtraction,
multiplication, division, etc. You are requested to develop an embedded software of a calculator with
following specifications:
a. This program takes an arithmetic operator (+, -, *, /) and two operands as the input.
b. It also checks whether the user wants to quit the program, if yes then terminate the program
execution. For this, you can use a special character and tell the user about it, like here we used
"X".
C.
The arithmetic operation is performed based on the operator and two operands inserted by user
in (a).
d. Display the complete arithmetic operation which includes the 2 operands, the arithmetic
operator, and the computation result.
Figure 5 shows samples of expected program execution output display for your reference in solution
development.
Enter an operator (+, -, *, /) or 'x' to exit: +
Enter two operands: 7.3 8.9
7.30 +8.90 = 16.20
Enter an operator (+, -, *, /) or 'x' to exit: -
Enter two operands: 8.5 12.34
8.50
12.34 = -3.84
Enter an operator (+, -, *, /) or 'x' to exit: *
Enter two operands: 1.5 100
1.50
100.00 = 150.00
Enter an operator (+, -, *, /) or 'x' to exit: /
Enter two operands: 8 3
8.00/3.00 = 2.67
Enter an operator (+, -, *, /) or 'x' to exit: x
Exit the program!
Figure 5
1. Sketch a flowchart which provides solution according to the given specification and requirement.
2. Based on your flowchart, derive the complete C code to deliver the simple calculator.
Transcribed Image Text:A calculator is an electronic device that is used to perform arithmetic operations like addition, subtraction, multiplication, division, etc. You are requested to develop an embedded software of a calculator with following specifications: a. This program takes an arithmetic operator (+, -, *, /) and two operands as the input. b. It also checks whether the user wants to quit the program, if yes then terminate the program execution. For this, you can use a special character and tell the user about it, like here we used "X". C. The arithmetic operation is performed based on the operator and two operands inserted by user in (a). d. Display the complete arithmetic operation which includes the 2 operands, the arithmetic operator, and the computation result. Figure 5 shows samples of expected program execution output display for your reference in solution development. Enter an operator (+, -, *, /) or 'x' to exit: + Enter two operands: 7.3 8.9 7.30 +8.90 = 16.20 Enter an operator (+, -, *, /) or 'x' to exit: - Enter two operands: 8.5 12.34 8.50 12.34 = -3.84 Enter an operator (+, -, *, /) or 'x' to exit: * Enter two operands: 1.5 100 1.50 100.00 = 150.00 Enter an operator (+, -, *, /) or 'x' to exit: / Enter two operands: 8 3 8.00/3.00 = 2.67 Enter an operator (+, -, *, /) or 'x' to exit: x Exit the program! Figure 5 1. Sketch a flowchart which provides solution according to the given specification and requirement. 2. Based on your flowchart, derive the complete C code to deliver the simple calculator.
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage