001package enumeration2;
002
003public enum Op {
004        ADD("+") { public int eval(int x, int y) { return x + y; } },
005        SUB("-") { public int eval(int x, int y) { return x - y; } },
006        MUL("*") { public int eval(int x, int y) { return x * y; } },
007        DIV("/") { public int eval(int x, int y) { return x / y; } };
008
009        private final String name;
010        private Op(String name) { this.name = name; }
011
012        public String toString() { return name; }
013        public abstract int eval(int x, int y);
014}
015