SIMPLE INTEREST
INTERFACE:
import [Link].*;
public interface Interest extends Remote
public abstract int getInterest(int principle, int time, int rate) throws RemoteException;
public abstract String getTotal() throws RemoteException;
IMPLEMENTATION FILE:
import [Link].*;
import [Link].*;
public class InterestImpl extends UnicastRemoteObject implements Interest
int interest, principle;
public InterestImpl() throws RemoteException
super();
public int getInterest(int principle, int time, int rate) throws RemoteException
[Link]=principle;
interest = (principle*time*rate)/100;
return interest;
public String getTotal() throws RemoteException
String str = "Pay Rs." +(principle+interest)+ " to clear the debt completely";
return str;
CLIENT CODE:
import [Link].*;
public class InterestClient
public static void main(String args[]) throws Exception
Interest i2 = (Interest) [Link]("roses");
int interestAmount = [Link](5000, 3, 12);
[Link]("Pay interest Rs." + interestAmount);
String str1 = [Link]();
[Link](str1);
[Link]("Pay interest Rs."+[Link](6500, 2, 10));
[Link]([Link]());
SERVER CODE:
import [Link].*;
public class InterestServer
public static void main(String args[]) throws Exception
Interest i1= new InterestImpl();
[Link]("roses", i1); // roses is alias name for i1 and is used later by the client
[Link]("Server is ready for remote invocations by client");