Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA Stack Program Write a program in java that can: Just some test data you may use. USE THIS as a template for stack class.

JAVA Stack Program

Write a program in java that can:

image text in transcribed

Just some test data you may use.

image text in transcribed

USE THIS as a template for stack class.

image text in transcribed

image text in transcribed

1. Verify equations based on balanced parentheses, brackets, and curly braces. (50) a. Examples of good equations i. (a +b)/c ii. ([a +b) *a/b+1 iii.a (b /c) b. Exariples of bad equations i. (a + b/c ii.0(0) iii.if you eat a lot/(you will belch)) 2. Evaluate post fix equations.(100) a. Exarple i. 12+3*results in 6 233+*results ir 12 3. Infix to PostFix (100) a. Example i. (a + b)*c > abre* atbcabc*+ 4. Use your sequence of programs to evaluate, convert and solve equations parentheses tests x(12)*3 x12) 3 postfix equation solving 73+9 52 19* * 89*35 + - 2 + 84/ infix to postfix conversion (8 +4) 9 (98)-(5+3) 3 (9 3) Parentheses check, infix to postfix conversion, postfix evaluation (8+ 4) * 9 3 + (9/3) class stackOb int top: char stack int maxLen; public stackOb(int maxLen) stack new char[maxLen]; top--1 this.maxLen maxLen; public void push(char item) public char pop) public boolean empty( public void reset() top1 public void showStack() int j System.out.printin(" "; System.out.printin( Stack contents.."); fori-top:j>-1j-)( System.out.println(stack]) System.out.println(" "); public void showStackotoTop() int j System.out.println(" ") System.out.println("Stack contents ..."); forG-0:j-top:j++) System.out.print(stack[j]); System.out.println(" "); 1. Verify equations based on balanced parentheses, brackets, and curly braces. (50) a. Examples of good equations i. (a +b)/c ii. ([a +b) *a/b+1 iii.a (b /c) b. Exariples of bad equations i. (a + b/c ii.0(0) iii.if you eat a lot/(you will belch)) 2. Evaluate post fix equations.(100) a. Exarple i. 12+3*results in 6 233+*results ir 12 3. Infix to PostFix (100) a. Example i. (a + b)*c > abre* atbcabc*+ 4. Use your sequence of programs to evaluate, convert and solve equations parentheses tests x(12)*3 x12) 3 postfix equation solving 73+9 52 19* * 89*35 + - 2 + 84/ infix to postfix conversion (8 +4) 9 (98)-(5+3) 3 (9 3) Parentheses check, infix to postfix conversion, postfix evaluation (8+ 4) * 9 3 + (9/3) class stackOb int top: char stack int maxLen; public stackOb(int maxLen) stack new char[maxLen]; top--1 this.maxLen maxLen; public void push(char item) public char pop) public boolean empty( public void reset() top1 public void showStack() int j System.out.printin(" "; System.out.printin( Stack contents.."); fori-top:j>-1j-)( System.out.println(stack]) System.out.println(" "); public void showStackotoTop() int j System.out.println(" ") System.out.println("Stack contents ..."); forG-0:j-top:j++) System.out.print(stack[j]); System.out.println(" ")

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

More Books

Students also viewed these Databases questions