For this assignment you are tasked with writing a command-line Java program that evaluates Reverse Polish notation (RPN) formulas. Here are the details: • Due date is as specified on the letter you received from the student office. ● Submission will be through the Moodle. Submit a file called Submission.java. This must be a Java program that: Correctly compiles under the UNIX command line (for optimal results, test your program or Raptor). When run from the command line your program must read from standard input an RPN formula. . . You can assume there is a space between every operator and number. Every number will a 32 bit integer. . Your program should be able to correctly handle the operations: +, -, X. IMPORTANT: be careful that your program recognises precisely the three characters above (plus sign, minus sign, and the lowercase letter "x", respectively). • Your program then should write to standard out a single line with the correct output in standard integer format. The following example shows correct behaviour for your program ● • Other examples of NPN formulas are: 3 (result is 3) ● cd472$ javac Submission.java cd472$ echo 75 125 + | java Submission 200 ● 20 x (result is 0) 2 3+2 2 + x (result is 20) • 2 3 x 4 + (result is 10) • You can read more about RPN here:https://en.wikipedia.org/wiki/Reverse_Polish_notatic • As with all regular assignments you may NOT use any Java standard library class or method other than for input/output.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
For this assignment you are tasked with writing a command-line Java program that evaluates
Reverse Polish notation (RPN) formulas. Here are the details:
• Due date is as specified on the letter you received from the student office.
●
Submission will be through the Moodle. Submit a file called
Submission.java.
This must be a Java program that:
Correctly compiles under the UNIX command line (for optimal results, test your program on
Raptor).
When run from the command line your program must read from standard input an RPN
formula.
.
.
You can assume there is a space between every operator and number. Every number will be
a 32 bit integer.
.
Your program should be able to correctly handle the operations: +, -, X.
IMPORTANT: be careful that your program recognises precisely the three characters
above (plus sign, minus sign, and the lowercase letter "x", respectively).
• Your program then should write to standard out a single line with the correct output in
standard integer format. The following example shows correct behaviour for your program:
●
• Other examples of NPN formulas are:
3 (result is 3)
●
cd472$ javac Submission.java
cd472$ echo 75 125 + | java Submission
200
●
20 x (result is 0)
2 3+2 2 + x (result is 20)
• 2 3 x 4 + (result is 10)
• You can read more about RPN here:https://en.wikipedia.org/wiki/Reverse_Polish_notation
• As with all regular assignments you may NOT use any Java standard library class or
method other than for input/output.
Transcribed Image Text:For this assignment you are tasked with writing a command-line Java program that evaluates Reverse Polish notation (RPN) formulas. Here are the details: • Due date is as specified on the letter you received from the student office. ● Submission will be through the Moodle. Submit a file called Submission.java. This must be a Java program that: Correctly compiles under the UNIX command line (for optimal results, test your program on Raptor). When run from the command line your program must read from standard input an RPN formula. . . You can assume there is a space between every operator and number. Every number will be a 32 bit integer. . Your program should be able to correctly handle the operations: +, -, X. IMPORTANT: be careful that your program recognises precisely the three characters above (plus sign, minus sign, and the lowercase letter "x", respectively). • Your program then should write to standard out a single line with the correct output in standard integer format. The following example shows correct behaviour for your program: ● • Other examples of NPN formulas are: 3 (result is 3) ● cd472$ javac Submission.java cd472$ echo 75 125 + | java Submission 200 ● 20 x (result is 0) 2 3+2 2 + x (result is 20) • 2 3 x 4 + (result is 10) • You can read more about RPN here:https://en.wikipedia.org/wiki/Reverse_Polish_notation • As with all regular assignments you may NOT use any Java standard library class or method other than for input/output.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Constants and Variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education