Server Fib function: remove guard for negative input ( to match python tutorials)

Client: remove extra example calls
This commit is contained in:
Ann Witbrock 2011-04-26 12:08:00 +01:00
parent cb591b06b2
commit 53f47dad55
2 changed files with 3 additions and 8 deletions

View File

@ -58,12 +58,6 @@ public class RPCClient {
System.out.println(" [x] Requesting fib(30)");
response = fibonacciRpc.call("30");
System.out.println(" [.] Got '" + response + "'");
System.out.println(" [x] Requesting fib(-1)");
response = fibonacciRpc.call("-1");
System.out.println(" [.] Got '" + response + "'");
System.out.println(" [x] Requesting fib(a)");
response = fibonacciRpc.call("a");
System.out.println(" [.] Got '" + response + "'");
}
catch (Exception e) {
e.printStackTrace();

View File

@ -9,8 +9,9 @@ public class RPCServer {
private static final String RPC_QUEUE_NAME = "rpc_queue";
private static int fib(int n) {
if (n > 1) return fib(n-1) + fib(n-2);
else return n;
if (n ==0) return 0;
if (n == 1) return 1;
return fib(n-1) + fib(n-2);
}
public static void main(String[] argv) {