#### Details of this Paper

##### Simple RPN calculator. RPN stands for Reverse Polish Notation (A.K.A Postfix notation). In Reverse Polish Notation the user inputs two...

**Description**

solution

**Question**

Simple RPN calculator. RPN stands for Reverse Polish Notation (A.K.A Postfix notation). In Reverse Polish Notation the user inputs two numbers and then an operator. The RPN calculator asks for two values and an operator. After it performs the appropriate operation, it asks for another value and an another operator. Then it performs the appropriate operation on the value and the result from the previous operation. Then it asks for another value and operator and uses the previous result and the value to perform the operation, and so on until the user hits the letter ?q? in place of an operator. Then the program exits.;Valid operations are: +, -, *, /, nCr.;nCr is the choose (binomial) operator from combinatorics: n!/(k!(n-k)!).;All of the arithmetic operations should be carried out within a function;Here are the specs;Your program should be called RPNCalc.java.;It must have, at a minimum, the following methods/functions;public static double sum(double a, double b) // a+b;public static double minus(double a, double b) // a - b;public static double times(double a,double b) // a*b;// a/b (division by 0 is not allowed.;// System prints Error and continues without the division).;public static double divide(double a, double b);//nCr (which can only be done with integer parts of the numbers);public static double nCr(double a, double b);public static int factorial(int n) // n! (will help with nCr);Rubric;Program must compile. Otherwise you get 0 points, so test it before you send it in.;All functions and conventions respected: 35;Functions work correctly: 40;Calculator works correctly: 25 (asks for input in the order established. Also, see example).;Sample run (bold font indicates System output. Non-bold is user input);Enter one of the valid operations: + - * / nCr;Enter q for the operation to quit the program.;X: 5;Y: 12;Op: *;60.0;Y: 7;Op: /;8.571428571428571;Y: 2;Op: +;10.571428571428571;Y: 1;Op: -;9.571428571428571;Y: 2;Op: nCr;36.0;Y: 0;Op: q;Your last result was: 36.0;And in an error, the relevant portion may look like this;3;Y: 0;Op: /;Error, attempted a division by zero;3.0;Y

Paper#72531 | Written in 18-Jul-2015

Price :*$22*