uebungen/sources/beispieleVL/enumeration/Rechner.java

19 lines
549 B
Java
Raw Normal View History

package enumeration;
public class Rechner {
public double rechne(double op1, double op2, Operation operation) {
return operation.anwenden(op1, op2);
}
public static void main(String[] args) {
Rechner r = new Rechner();
double summe = r.rechne(5, 5, Operation.ADDITION);
double differenz = r.rechne(6, 3, Operation.SUBTRAKTION);
double produkt = r.rechne(6, 3, Operation.MULTIPLIKATION);
System.out.printf("%.0f, %.0f, %.0f", summe, differenz, produkt);
}
}