- InterConvert.java
import java.rmi.*;
public interface InterConvert extends Remote {
public String convertDigit(String no) throws Exception;
} - ServerConvert.java
import java.rmi.;
import java.rmi.server.;
public class ServerConvert extends UnicastRemoteObject implements InterConvert {
public ServerConvert() throws Exception { }
public String convertDigit(String no) throws Exception {
String str = "";
for(int i = 0; i < no.length(); i++) {
int p = no.charAt(i); if( p == 48) {
str += "zero ";
} if( p == 49) {
str += "one ";
} if( p == 50) {
str += "two ";
} if( p == 51) {
str += "three ";
} if( p == 52) {
str += "four ";
} if( p == 53) {
str += "five ";
} if( p == 54) {
str += "six ";
} if( p == 55) {
str += "seven ";
} if( p == 56) {
str += "eight ";
} if( p == 57) {
str += "nine ";
}
} return str;
}
public static void main(String args[]) throws Exception {
ServerConvert s1 = new ServerConvert();
Naming.bind("Wrd",s1);
System.out.println("Object registered....");
}
} - ClientConvert.java
import java.rmi.;
import java.io.;
public class ClientConvert {
public static void main(String args[]) throws Exception {
InterConvert h1 = (InterConvert)Naming.lookup("Wrd");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter a number : \t");
String no = br.readLine();
String ans = h1.convertDigit(no);
System.out.println("The word representation of the entered digit is : " +ans);
}
}
x=float(input("Enter value of x:"))
w=float(input("Enter value of weight w:"))
b=float(input("Enter value of bias b:"))
net = int(w*x+b)
if(net<0):
out=0
elif((net>=0)&(net<=1)):
out =net
else:
out=1
print("net=",net)
print("output=",out)
0 Reviews