Back to project page MathApp.
The source code is released under:
MIT License
If you think the Android project MathApp listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package ie.lc.mathApp; /*from w w w.ja v a2 s . c o m*/ public enum Operator { plus, minus, multiply, divide; public String toString() { switch (this) { case plus: return "+"; case minus: return "?"; case multiply: return ""; case divide: return ""; default: return "?"; } } public static Operator random() { Operator[] vals = Operator.values(); return vals[ Util.randomIntRange(0, vals.length) ]; } public double evaluate( double left, double right ) { switch (this) { case plus: return left + right; case minus: return left - right; case multiply: return left * right; case divide: return left / right; default: return Double.NaN; } } }