How to create your own operationsĪpplication has abstrach class Operation. Jar file with java-doc you can find in the target directory with name: In addition you can open target/apidocs directory in your browser to work with documentation. Or run run_exampleFiles.sh (Linux or Mac).īuild process includes prepare standard Java-doc files. To see how application works with files as input resource use: mvn -q exec:java -Dexec.mainClass="" < example1.txt Test wrong parameters and correct working after that.Test operations working operations (+-*/). To run application use next command: mvn -q exec:java -Dexec.mainClass="" Maven will load set of additional libraries so it might take few minutes to build. Result jar file location: target/īe patient first time. To build application use next command: mvn clean installĪpplication will be built, tested and ready to use. InstallationĬlone the the repository (use command and link in github). Operation – abstract class which declare Operation Implementation 1. RPNCalculator – class with implementation ClassesĪppRPN – main class which initialise RPNCalculator, adds supported Operations This point allows you create your own operations. I use java language because it allows run application on Linux, Windows and Linux operation system.Īs a software project management, build and run system I use maven – because it is most popular and allows work with complex projects.Īpplication has abstraction: operation. It exits when it receives a q command or an end of input indicator (EOF / Ctrl+D).It handles errors (wrong numbers) and recover gracefully (displays Error message and recover to init state).It works with double numerics (3.14, 1.15, etc…).It implements the four standard arithmetic operators (+-*/).For binary operations (2 numbers req.) type the 1st number, click the Enter button, type the 2nd number, and then click the function. The calculator uses standard input and standard output To use Scientific Calculator RPN (Reverse Polish Notation) button operators (Complex operation capable): For unary operations (1 number req.), type the number into the input box and then click the function.TaskĬreate a RPN calculator which will read input stream and write results into output stream, process 4 base operations (+-*/). In it we should place the operator after the numbers. Ideal for engineering and computer science. Reverse polish notation, or RPN, is one of the three commonly used calculation notations. Experience TIs advanced, four-line scientific calculator with higher-level math and science functionality. Language: Java Java command line RPN calculator Task: Implement a command-line reverse polish notation (RPN) calculator using a language that you know well.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |