The code that i have in the interface is.
The first error that I am getting is highlighted in bold.
The error hear is Interface methods cannot have body.
import java.rmi.Remote;
import java.rmi.RemoteException;
interface Interface extends Remote{
//Returns the Sum of the Number
public void ReturnSum (String Sum) throws RemoteException
{
}
//Returns the Product of the Number
public void ReturnProduct (String Product) throws RemoteException
{
}
//Returns the Average of the Number
public void ReturnAverage (String Average) throws RemoteException
{
}
}//end Interface
And the code that i have in the class is.
The error that i am getting within this class is highlighted in bold.
This error is Helper is not abstract and does not override abstract method ReturnAverage(java.lang.String) in Interface
import java.net.*;
import java.io.*;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.rmi.registry.LocateRegistry;
import java.rmi.RMISecurityManager;
public class Helper implements Interface {
private final int SIZE =10;
private ASumList sumList[];
private int serverPort;
private int numNumber;
private InetAddress serverHost;
private StreamSocket mySocket;
// private InetAddress serverHost;
public Helper(){
super();
sumList = new ASumList [SIZE];
numNumber = 0;
}
Helper(String hostName,String portNum) throws SocketException,
UnknownHostException, IOException {
this.serverHost = InetAddress.getByName(hostName);
this.serverPort = Integer.parseInt(portNum);
//Instantiates a stream-mode socket and wait for a connection.
this.mySocket = new StreamSocket(this.serverHost, this.serverPort);
System.out.println("Connection request made");
} // end constructor
public String getnumber( String message) throws SocketException, IOException{
String number = "", nextnumber="";;
mySocket.sendMessage( message);
// now receive the names
nextnumber = mySocket.receiveMessage();
while (!nextnumber.equals("")) {
number += nextnumber+" ";
nextnumber = mySocket.receiveMessage();
}
return number;
} // end getnumber
public synchronized int ReturnSum (){
String list ="";
for (int i = 0; i < numNumber; i++)
list = list+ sumList[i].getSum();
list.trim();
return numNumber;
}
public synchronized int Returnproduct(){
String list ="";
for (int i =0;i<numNumber; i++)
list = list+sumList[i].getSum();
list.trim();
return numNumber;
}
public synchronized int ReturnAverage(){
String list ="";
for (int i = 0; i<numNumber; i++)
list = list+sumList[i].getSum();
list.trim();
return numNumber;
}
public void done( ) throws SocketException, IOException{
mySocket.close( );
} // end done
} //end class
Would be greatful if anyone can help.
Thanks