Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions student-submission/BESE2018/Shreejana Pandit/Client.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import java.rmi.registry.locateRegistry;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.util.*;
public class client{
private client(){
}
public static void main(String[] args) {
try{
//Getting the registry
Registry registry =LocateRegistry.getRegistry("localhost");
//Looking up thebregistry for the remate object
MyInterface stub=(MyInterface) registry.lookup("MyInterface");
//Calling the remate mathod using the obtained object
stub.printMsg();
stub.calculateAreaOfcircle(21.0);
stub.calculateVolumeOfRectangle(10.0,12.0,15.0);

//System.out.println("Remote method invoked");
Scanner scanner = new Scanner(System.in);
System.out.println("Enter the amount :");
double amount=scanner.nextDouble();

System.out.println("Enter the tax rate :");
double taxRate=scanner.nextDouble();

stub.setTaxRate(taxRate);
stub.calculateTax(amount);
}
catch(Exception e){
System.err.println("Client exception: " + e.toString());
e.printStackTrace();
}
}
}
19 changes: 19 additions & 0 deletions student-submission/BESE2018/Shreejana Pandit/MyImplementation.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
public class MyImplementation implements MyInterface{
private double taxRate;
public void printMsg(){
System.out.print ("Hello Implement class");
}
public void calculateAreaOfcircle(double radius){
final double PI=3.1415;
System.out.println("The area of circle is:"+PI*radius*radius);
}
public void setTaxRate(double taxRate){
this.taxRate=taxRate;
}
public void calculateTax(double amount){
System.out.println("The tax amount is:"+amount*taxRate/100);
}
public void calculateVolumeOfRectangle(double length,double breath, double height){
System.out.println("The volume of rectangle is:"+length*breath*height);
}
}
14 changes: 14 additions & 0 deletions student-submission/BESE2018/Shreejana Pandit/MyInterface.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface MyInterface extends Remote{
//method to calculate the area of circle
public void calculateAreaOfcircle(double radius)throws RemoteException;
//method to print simple message
public void printMsg()throws RemoteException;
//method to calculate tax amount
public void calculateTax(double amount)throws RemoteException;
//set the tax rate
public void setTaxRate(double taxRate)throws RemoteException;
//calculate the volume of rectangle
public void calculateVolumeOfRectangle(double length,double breath,double height)throws RemoteException;
}