编程论文代写:CalculatorClient.Java
Keywords:编程论文代写
这是一段JAVA程序的例子,为了保证程序不被泄露,完整性!请理解我们分段发布,如果你也需要留学生论文代写 请联系我们的客服
CalculatorClient.Java
import java.rmi.Naming;
import java.rmi.RemoteException;
import java.net.MalformedURLException;
import java.rmi.NotBoundException;
public class CalculatorClient {
public static void main(String[] args) {
try {
Calculator c =
(Calculator)Naming.lookup("rmi://localhost/CalculatorService");
double a = Double.parseDouble(args[0]);
double b = Double.parseDouble(args[2]);
String op = args[1];
System.out.println("your calculation is : " + c.calculate(a,op,b));
System.out.println("Operators Used: " + c.showOperators());
}
catch (MalformedURLException murle) {
System.out.println();
System.out.println("MalformedURLException");
System.out.println(murle);
}
catch (RemoteException re) {
System.out.println();
System.out.println("RemoteException");
System.out.println(re);
}
catch (NotBoundException nbe) {
System.out.println();
System.out.println("NotBoundException");
System.out.println(nbe);
}
catch (
java.lang.ArithmeticException
ae) {
System.out.println();
System.out.println("java.lang.ArithmeticException");
System.out.println(ae);
}
}
}