Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please make sure that these infix and postfix equations have these answers nothing else: Infix: (3 * 4 - (2 + 5)) * 4 /

Please make sure that these infix and postfix equations have these answers nothing else:

Infix:

(3 * 4 - (2 + 5)) * 4 / 2 = valid expression

10 + 6 * 11 -(3 * 2 + 14) / 2 = valid expression

Postfix:

9 3 / 6 / 4 * 10 - = -8

9 3 / 6 / 4 * -10 - = 12

(a) Using java.util.stack to write a java program to validate and calculate the result of each arithmetic Expression from input file (infix.dat). All equations from the input file are in traditional infix notation. Display each expression first. Then, if the arithmetic expression is not valid, display Invalid expression message otherwise display the result of the calculation.

(b) Using java.util.Stack and java.util.StringTokenizer to write a java program to validate and calculate postfix expression from the input data file - postfix.dat

infix.dat

5 * 6 + 4 3 - 2 + ( 3 * 4 - (2 + 5)) * 4 / 2 10 + 6 * 11 -(3 * 2 + 14) / 2 2 * (12 + (3 + 5 ) * 2

postfix.dat

5 2 + 8 5 - * 2 4 - 5 2 * + 5 2 6 3 - * + 4 + 2 3 1 + * 7 5 0 / 9 3 / 6 / 4 * 10 - 3 / + 9 3 / 6 / 4 * 10 - 5 2 6 3 - * + 4 + 2 3 1 + * 7 - * 9 3 / 6 / 4 * -10 -

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_2

Step: 3

blur-text-image_3

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

The Database Relational Model A Retrospective Review And Analysis

Authors: C. J. Date

1st Edition

0201612941, 978-0201612943

More Books

Students also viewed these Databases questions

Question

Calculate the missing values for the promissory notes described

Answered: 1 week ago

Question

f. Did they change their names? For what reasons?

Answered: 1 week ago

Question

Solve for x: 2(3x 1)2(x + 5) = 12

Answered: 1 week ago

Question

7. Discuss the key features of the learning organization.

Answered: 1 week ago