0% found this document useful (0 votes)
50 views3 pages

Simple Interest Interface

This document describes a simple interest calculator implemented using Java RMI (Remote Method Invocation). It defines an Interest interface with methods to calculate interest and get the total amount. An InterestImpl class implements this interface. A server binds an instance to a name that clients can lookup to invoke the remote methods. The client code calls the interest calculation and total retrieval methods, passing different principle and rate values.

Uploaded by

Madhu arnav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views3 pages

Simple Interest Interface

This document describes a simple interest calculator implemented using Java RMI (Remote Method Invocation). It defines an Interest interface with methods to calculate interest and get the total amount. An InterestImpl class implements this interface. A server binds an instance to a name that clients can lookup to invoke the remote methods. The client code calls the interest calculation and total retrieval methods, passing different principle and rate values.

Uploaded by

Madhu arnav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

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");

You might also like