Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
MATERIA
ARQUITECTURA DE DATOS
PROFESOR:
ESTUDIANTES:
ID:000272349
ID:000227869
GIRARDOT
(2020)
1. CREAR APLICACIÓN JAVA AA4, LUEGO CREAR UN JAVA CLASS Y
GUARDAR EN LLAMARLA CALCULADORA, LUEGO COPILAMOS LA
SIGUIENTE LÍNEA DE CÓDIGO.
import java.rmi.Remote;
import java.rmi.RemoteException;
}
• PANTALLAZO DE LIENA DE CODIGO.
package aa4;
import java.rmi.server.UnicastRemoteObject;
import java.rmi.RemoteException;
• PANTALLAZO.
3. DENTRO APLICACIÓN JAVA AA4 CREAR UNA JAVA CLASS LLAMADA
SERVIDOR, LUEGO COPILAMOS LA SIGUIENTE LÍNEA DE CÓDIGO.
package aa4;
import java.rmi.registry.Registry;
import javax.swing.JOptionPane;
public class Servidor {
public static void main(String[] args) {
try{
Registry r =
java.rmi.registry.LocateRegistry.createRegistry(1099);
r.rebind("Calculadora", new rmi());
JOptionPane.showMessageDialog(null, "Servidor Conectado");
}catch(Exception e){
JOptionPane.showMessageDialog(null, "Servidor no
Conectado" + e);
}
}
}
• PANTALLAZO SERVIDOR.
package aa4;
import java.rmi.Naming;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.util.Scanner;
import javax.swing.JOptionPane;
public class Cliente {
while (true){
String menu = JOptionPane.showInputDialog(" Calculadora \n
*Actividad 4 RMI*\n ")
+"Suma...(1)\n"
+"Resta...(2)\n"
+"Multiplicacion...(3)\n"
+"Divicion...(4)\n"
+"Cancelar para salir";
switch (menu) {
case "1": {
int x = Integer.parseInt(JOptionPane.showInputDialog("Ingrese el
primer numero"));
int y = Integer.parseInt(JOptionPane.showInputDialog("Ingrese el
segundo numero"));
}
case "3": {
int x = Integer.parseInt(JOptionPane.showInputDialog("Ingrese
el primer numero"));
int y = Integer.parseInt(JOptionPane.showInputDialog("Ingrese el
segundo numero"));
JOptionPane.showMessageDialog(null,"La Multiplicacion es: "
+c.mul(x,y));
break;
}
case "4": {
int x = Integer.parseInt(JOptionPane.showInputDialog("Ingrese
el primer numero"));
int y = Integer.parseInt(JOptionPane.showInputDialog("Ingrese el
segundo numero"));
}
}catch(Exception e) {
System.out.println("Servidor no conectado" + e);
}
}
}
• CORREMOR LA CLASS SERVIDOR, NOS ARROJA UN MENSAJE DONDE NOS DICE QUE
EL SERVIDOR ESTA CONECTADO Y LE DAMOS ACEPTAR.
• CORREMOR LA CLASS CLIENTE, NOS ARROJA UN MENSAJE DONDE NOS BIRNDAN
UNAS OPCIONES, SUMA ES IGUAL 1, RESTA A 2, MULTIPLICACION A 3, DIVICION A 4
Y CANCELAR PARA SALIR.