Question: I need this question answered and I cannot used Linked List. For this project, I need to develop a Java program that will act as

I need this question answered and I cannot used Linked List.

For this project, I need to develop a Java program that will act as an RPN (reverse polish notation) calculator. To do this, I have to use the stack class (stack of integers), together with a driver program which can handle the operations:

+ add the top two items

* multiply the top two items

- subtract the top item from the next item

/ integer divide the second item by the top item

% find the integer remainder when dividing the second item by the top item

m unary minus -- negate the top item

r exchange the top two items

d duplicate top item on stack

p print (to the screen) the top item

n print and remove the top item

f print all the contents of the stack (leaving it intact)

c clear the stack

q quit

h (or ?) print a help message

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!