Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I'm in need of help with coming up with a java code. I would need to create an RPN Calculator and these are the requirements.
I'm in need of help with coming up with a java code. I would need to create an RPN Calculator and these are the requirements. Thank you in advance!
THE ASSIGNMENT: For this project, you will develop a Java program that will act as an RPN (reverse polish notation calculator. To do this, you will 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 9 quit h (or ?) print a help message . There is a similar) standard RPN calculator called 'de' (desk calculator) on almost all UNIX systems. Your program will have keyboard input from the user of the program. Example: (note: @ stands for typing a return) n r h@ p print top print top and remove duplicate top exchange top two items f print contents of stack clear stack add subtract multiply / integer divide $ integer remainder unary minus a quit h,? this help + m 33 44 p @ 33 44 # rf @ 44 33 # n @ 44 d@ 33 33 # + p @ 66 21 1386 11 + p @ 1397 17 / p @ 82 2 -2 -2 # # THE ASSIGNMENT: For this project, you will develop a Java program that will act as an RPN (reverse polish notation calculator. To do this, you will 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 9 quit h (or ?) print a help message . There is a similar) standard RPN calculator called 'de' (desk calculator) on almost all UNIX systems. Your program will have keyboard input from the user of the program. Example: (note: @ stands for typing a return) n r h@ p print top print top and remove duplicate top exchange top two items f print contents of stack clear stack add subtract multiply / integer divide $ integer remainder unary minus a quit h,? this help + m 33 44 p @ 33 44 # rf @ 44 33 # n @ 44 d@ 33 33 # + p @ 66 21 1386 11 + p @ 1397 17 / p @ 82 2 -2 -2 # #
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started