class App1 extends Expr { int rator; Expr rand; App1 (int _rator, Expr _rand) { rator = _rator; rand = _rand; } public double value () { double arg = rand.value (); switch (rator) { case ABS: return Math.abs (arg); case ACOS: return Math.acos (arg); case ASIN: return Math.asin (arg); case ATAN: return Math.atan (arg); case CEIL: return Math.ceil (arg); case COS: return Math.cos (arg); case EXP: return Math.exp (arg); case FLOOR: return Math.floor (arg); case LN: return Math.log (arg); /*DP*/ case LOG: return Math.log (arg)/Math.log (10); /*DP*/ case NEG: return -arg; case ROUND: return Math.round (arg); case SIN: return Math.sin (arg); case SQRT: return Math.sqrt (arg); case TAN: return Math.tan (arg); default: throw new RuntimeException ("BUG: bad rator"); } } }