blob: 3051fb344aeda8803565e18b7553af71f06c732e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
package test.misc.en;
public enum Operation {
PLUS(2) {
double eval(double x, double y) { return x + y; }
},
MINUS(7) {
double eval(double x, double y) { return x - y; }
},
TIMES(8) {
double eval(double x, double y) { return x * y; }
},
DIVIDED_BY(0) {
double eval(double x, double y) { return x / y; }
};
// Perform the arithmetic operation represented by this constant
abstract double eval(double x, double y);
Operation(int t) {
// class LocalClass {
//
// }
//
// LocalClass e = null;
System.out.println();
}
public static void main(String args[]) {
double x = Double.parseDouble(args[0]);
double y = Double.parseDouble(args[1]);
Operation opp = Operation.DIVIDED_BY;
switch(opp) {
case MINUS:
System.out.println();
case PLUS:
}
for (Operation op : Operation.values()) {
System.out.println(x + " " + op + " " + y + " = " + op.eval(x, y));
}
}
}
|