rmi integral

hi, i have trpouble with difficult program about integral.Thx

package rmiexample;

publicinterface Evaluatable{

publicdouble evaluate (double valuate);

}

package rmiexample;

publicclass Integral{

publicstaticdouble sum(double start,double stop,double stepSize,Evaluatable evalObj){

double sum = 0.0, current = start;

while (current <= stop){

sum += evalObj.evaluate(current);

current += stepSize;

}

return(sum);

}

publicstaticdouble integrate(double start,double stop,int numSteps,Evaluatable evalObj){

double step = (stop - start) / (double)numSteps;

start = start + stopSize / 2.0;

return(stepSize * sum(start, stop, stepSize, evalObj));

}

}

package rmiexample;

import java.rmi.*;

publicinterface RemoteIntegralextends Remote{

publicdouble sum(double start,double stop,double stepSize, Evaluatable evalObj)

throws RemoteException;

publicdouble integrate(double start,double stop,int numSteps, Evaluatable evalObj)

throws RemoteException;

}

//sdileni clientem a serverem

package rmiexample;

//

publicclass RemoteIntegralclient{

publicstaticvoid main(String[] args){

try{

String host = (args.length > 0) ? args [0] :"localhost";

RemoteIntegral remoteIntegral = (RemoteIntegral)Naming.lookup("rmi://" + host +"/RemoteIntegral");

for(int steps=10; steps<=10000; steps*=10){

System.out.println("Approximated with " + steps +" steps:" +"\n Integral from 0 to pi of sin(x)=" + remoteIntegral.integrate(0.0, Math.PI, steps,new Sin()));

}

System.out.println("'Correct' answer using Math library:" +\n Integral from 0 to pi of sin(x)=" +(-Math.cos(Math.PI) - -Math.cos(0.0)));

}catch(RemoteException re){

System.out.println("RemoteException: " + re);

}catch(NotBoundException nbe){

System.out.println("NotBoundException: " + nbe);

}catch("MalformedURLException: " + mfe){

System.out.println("MalformedURLException: "+ mfe);

}

}

}

package rmiexample;

publicclass RemoteIntegralClient2{

publicstaticvoid main(String[] args){

try{

System.setSecurityManager(new RMIsecurityManager());

String host = (args.length > 0) ? args [0] :"localhost";

RemoteIntegral remoteIntegral = (RemoteIntegral)Naming.lookup("rmi://" + host +"/RemoteIntegral");

for(int steps=10; steps<=10000; steps*10=10){

System.out.println("Approximated with " + steps +" steps:" +"\n Integral from 0 to pi of sin(x)=" + remoteIntegral.integrate(0.0, Math.PI, steps,new Sin()));

}

System.out.println("'Correct' answer using Math library:" +\n Integral from 0 to pi of sin(x)= +(-Math.cos(Math.PI) - -Math.cos(0.0)));

}catch(RemoteException re){

System.out.println("RemoteException> " + re);

}catch(NotBoundException nbe){

System.out.println("NotBoundException: " + nbe);

}catch(MalformedURLException:" + mfe){

System("MalformedURLException: + mfe);

}

}

}

package rmiexample;

//remote interal implementation

import java.rmi.*;

import java.rmi.server.UnicastRemoteObject;

publicclass RemoteIntegralImpextends UnicastRemoteObjectimplements RemoteIntegral{

public RemoteIntegralImp()throws RemoteException{}

publicdouble sum(double start,double stop,double stepSize,Evaluatable evaObj){

return(Integral.sum(start, stop, stepSize, evalObj));

}

publicdouble integrate(double start,double stop,int numSteps,Evaluatable){

return(Integral.integrate(start, stop, numSteps, evalObj));

}

}

package rmiexample;

//remote integral server

import java.rmi.*;

import java.net.*;

publicclass RemoteIntegralServer{

publicstaticvoid main(String[] args){

try{

RemoteIntegralImpl integral =new RemoteIntegralImpl();

Naming.rebind("rmi:///RemoteIntegral", integral);

}catch(RemoteException re){

System.out.println("RemoteException : + re);

}catch(MalformedURLException mfe){

System.out.println("MalformedURLException: " + mfe);

}

}

}

package rmiexample;

//remote integral client

import java.io.Serializable;

class Sinimplements Evaluatable, Seriazable{

publicdouble evaluate val){

retrn(Math.sin(val));

}

public String toString(){

return("Sin")

}

}

[10799 byte] By [hanspetergeerdesa] at [2007-11-27 3:53:35]
# 1
What is your question?
AnanSmritia at 2007-7-12 8:57:39 > top of Java-index,Core,Core APIs...
# 2
Hi, i'm hanspetergeerdes because my account isn't actived.My problem is:My program isn't full function.there are more errors.I don't know how fixed it.My jdk is 1.5
baxxter.h.pa at 2007-7-12 8:57:39 > top of Java-index,Core,Core APIs...
# 3
Post your exception or error information.
AnanSmritia at 2007-7-12 8:57:39 > top of Java-index,Core,Core APIs...