lpr-b:clientecc
no way to compare when less than two revisions
Differenze
Queste sono le differenze tra la revisione selezionata e la versione attuale della pagina.
| — | lpr-b:clientecc [07/12/2007 alle 10:01 (18 anni fa)] (versione attuale) – creata Marco Danelutto | ||
|---|---|---|---|
| Linea 1: | Linea 1: | ||
| + | <code java> | ||
| + | package ccRMI; | ||
| + | |||
| + | import java.net.MalformedURLException; | ||
| + | import java.rmi.Naming; | ||
| + | import java.rmi.NotBoundException; | ||
| + | import java.rmi.RemoteException; | ||
| + | |||
| + | public class Client { | ||
| + | |||
| + | /** | ||
| + | * @param args | ||
| + | */ | ||
| + | public static void main(String[] args) { | ||
| + | |||
| + | if(args.length==0) { | ||
| + | System.out.println(" | ||
| + | return; | ||
| + | } | ||
| + | InterfacciaCC icc = null; | ||
| + | try { | ||
| + | String rmiUrl = " | ||
| + | System.out.println(" | ||
| + | icc = (InterfacciaCC) Naming.lookup(rmiUrl); | ||
| + | } catch (MalformedURLException e) { | ||
| + | e.printStackTrace(); | ||
| + | return; | ||
| + | } catch (RemoteException e) { | ||
| + | e.printStackTrace(); | ||
| + | return; | ||
| + | } catch (NotBoundException e) { | ||
| + | e.printStackTrace(); | ||
| + | return; | ||
| + | } | ||
| + | |||
| + | switch (args[2].charAt(0)) { | ||
| + | case ' | ||
| + | // saldo | ||
| + | try { | ||
| + | System.out.println(" | ||
| + | } catch (RemoteException e) { | ||
| + | e.printStackTrace(); | ||
| + | } | ||
| + | break; | ||
| + | } | ||
| + | case ' | ||
| + | // prelievo | ||
| + | try { | ||
| + | long saldo = icc.prelievo(Integer.parseInt(args[3])); | ||
| + | if(saldo < 0) { | ||
| + | System.out.println(" | ||
| + | } else { | ||
| + | System.out.println(" | ||
| + | } | ||
| + | } catch (NumberFormatException e) { | ||
| + | e.printStackTrace(); | ||
| + | } catch (RemoteException e) { | ||
| + | e.printStackTrace(); | ||
| + | } | ||
| + | break; | ||
| + | } | ||
| + | case ' | ||
| + | // versamento | ||
| + | try { | ||
| + | long saldo = icc.versa(Integer.parseInt(args[3])); | ||
| + | System.out.println(" | ||
| + | } catch (NumberFormatException e) { | ||
| + | // TODO Auto-generated catch block | ||
| + | e.printStackTrace(); | ||
| + | } catch (RemoteException e) { | ||
| + | // TODO Auto-generated catch block | ||
| + | e.printStackTrace(); | ||
| + | } | ||
| + | break; | ||
| + | } | ||
| + | default: { | ||
| + | System.out.println(" | ||
| + | return; | ||
| + | } | ||
| + | } | ||
| + | System.out.println(" | ||
| + | } | ||
| + | |||
| + | } | ||
| + | </ | ||
lpr-b/clientecc.txt · Ultima modifica: 07/12/2007 alle 10:01 (18 anni fa) da Marco Danelutto
