Question: USE THE PICTURE NOTES TO MAKE THE PROGRAM. It should have Evaluate.java, ArrayStack.java, and Stack.java files Try to write the program with comments if possible

USE THE PICTURE NOTES TO MAKE THE PROGRAM. It should have Evaluate.java, ArrayStack.java, and Stack.java files

Try to write the program with comments if possible for understanding

Evaluate Arithmetic Expressions Requirements:

public class Evaluate { public static int expression(String str) { // return the value } } 

Implement a concrete ArrayStack class that extends the Stack interface as we discussed in the class (any other different Stack class implementation, even if it is implemented by yourself, will not receive any credit).

Write a method that evaluates an arithmetic expression, which is given by a string.

Your implementation is required to use the Stack interface we discussed in the class.

Write a necessary test program to verify the result. For example,

14-3*4+2*5-6*2 (should return 0) and 

the implementation supports parentheses. For examples:

14-3*(4+2*(5-6))*2 (should return 2)

You may want to test all possible corner conditions to make sure your implement is inclusive.

Your implementation only considers +, - and * operators.

Stack implementation format:

public interface stack {

boolean isEmpty();

boolean isFull();

int size(); //this should return number of data elements

void push (Object item);

Object pop();

Object top();

}

public interfact stack {

boolean isEmpty();

boolean isFull();

int size(); //this should return number of data elements

void push (Object item);

Object pop();

Object top();

}

Array implementation Format

***************************

size()

return k+1

isEmpty()

return k==-1

isFull

return k==CAP-1

------------------

pop()

if (isEmpty()) then

retun null;

else

k=k-1

return Array[k+1]

-------------------

push()

if (isFull()) then

throw SomeException

else

Array[k] --- item

-------------------

top()

if (isEmpty()) then

return null

else

return Array[k];

USE THE PICTURE NOTES TO MAKE THE PROGRAM. It should have Evaluate.java,

Jipet: a String uputthe value wkle (there's Qauther token ) CeNumber)then else repeat Ops(2) opStk.push(z) Manu-Stk.puhL x op ?) return nuwtktp()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!