Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that graphically displays a working calculator for simple infix expressions that consist of single-digit operands; the operators +, -, *, and /;

Write a program that graphically displays a working calculator for simple infix expressions that consist of single-digit operands; the operators +, -, *, and /; and parentheses. Make the following assumptions:

Unary operators (as in -2) are illegal.

All operations, including division, are integer operations.

The input expression contains no embedded spaces and no illegal characters, since it is entered by using a keypad.

The input expression is a syntactically correct infix expression.

Division by zero will not occur. (Consider how you can remove this restriction.)

The calculator has a display and a keypad of 20 keys, which are arranged as follows:

C < Q /

7 8 9 *

4 5 6 -

1 2 3 +

0 ( ) =

As the user presses keys to enter an infix expression, the corresponding characters appear in the display. The C (Clear) key erases all input entered so far; the 6 (Backspace) key erases the last character entered. When the user presses the = key, the expression is evaluated and the result replaces the expression in the display window. The user can then press C and enter another expression. If the user presses the Q (Quit) key, the calculator ceases operation and is erased from the screen.

Task: 1.

Create Interface for the ADT stack.

2. Create a Class of Stack

3. Create Calculator GUI

PROVIDE WITH THE OUTPUT.

Include screenshots of your code and Screenshots of your output ONLY

Algorithm Pseudocode Flowchart Use case diagram Class diagram Activity diagram Class responsibility diagram

ALTHOUG CODE ALSO

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Autonomous Database In Enterprise Architecture

Authors: Bal Mukund Sharma, Krishnakumar KM, Rashmi Panda

1st Edition

1801072248, 978-1801072243

More Books

Students also viewed these Databases questions