Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

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.
expand button
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
Check Mark
Knowledge Booster
Background pattern image
Computer Science
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
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education