1 15 package org.apache.examples; 16 17 import org.apache.hivemind.Registry; 18 import org.apache.hivemind.impl.RegistryBuilder; 19 20 26 public class CalculatorMain 27 { 28 29 public static void main(String [] args) 30 { 31 double arg0 = Double.parseDouble(args[0]); 32 double arg1 = Double.parseDouble(args[1]); 33 34 Registry registry = RegistryBuilder.constructDefaultRegistry(); 35 36 40 Calculator calculator = (Calculator) registry.getService(Calculator.class); 41 42 System.out.println("Inputs: " + arg0 + " and " + arg1); 43 System.out.println("Add: " + calculator.add(arg0, arg1)); 44 System.out.println("Subtract: " + calculator.subtract(arg0, arg1)); 45 System.out.println("Multiply: " + calculator.multiply(arg0, arg1)); 46 System.out.println("Divide: " + calculator.divide(arg0, arg1)); 47 48 registry.shutdown(); 49 } 50 } 51 | Popular Tags |