Assignment 1

Due date: Monday April 13, 11:59pm (that's 60s before midnight)

Delivery: Tar and gzip your files (java source code, Makefile, etc) and send your files to both the TAs, Soner (soner@cs.uchicago.edu) and Sravana (sravana@cs.uchicago.edu). Include "CSPP51024 A1" in the subject line. [Detailed Instructions]

Grading:

Pass/Fail.  A failure deducts 2 points from the potential number of points you can get for Milestone 1. That is to say, it makes the total points available for Milestone 1 8 points instead of 10. A pass keeps the Milestone 1 points available at 10.

 

Part 1: Write a finger client as a Java application.

How does the finger client work?
It opens a socket connection to foo.bar.com using the finger port (well-known port: 79), and sends the username to the finger daemon running on the host, then reads back and prints out whatever finger information is available.
Details:
Additional requirements (please keep in mind that both are hard requirements): You would call your finger client  from the command line in one of these variants:  
IMPORTANT: For security reasons a finger server is not available in the CS cluster. To test your program, the server foo.bar.com must be a machine outside the CS cluster. Working servers and usernames for the first and second variant will be posted to the class mailing list.
Your program should print out whatever the finger server on  foo.bar.com returns. Like this:
% java edu.cspp51024.alkhafaj.Finger alkhafaj@buda.cs.uchicago.edu
[buda.cs.uchicago.edu]
Login: alkhafaj Name: Mohammed Alkhafaji
Directory: /home/alkhafaj Shell: /usr/bin/tcsh
Office: Ry403, 555-1212
On since Mon Mar 26 18:40 (CST) on pts/0 from :0.0
1 day 23 hours idle
On since Mon Mar 26 18:44 (CST) on pts/1 from :0.0
1 day 16 hours idle
On since Mon Mar 26 18:53 (CST) on pts/2 from :0.0
1 day 16 hours idle
On since Mon Mar 26 18:57 (CST) on pts/3 from :0.0
4 days 19 hours idle
On since Thu Mar 29 19:38 (CST) on pts/4 from :0.0
1 day 16 hours idle
On since Thu Mar 29 21:46 (CST) on pts/5 from :0.0
1 day 15 hours idle
On since Thu Mar 29 21:46 (CST) on pts/6 from :0.0
1 day 16 hours idle
On since Sat Mar 31 13:56 (CST) on pts/7 from nsit-s227-147.uchicago.edu
New mail received Sat Mar 31 14:20 2002 (CST)
Unread since Sat Mar 31 14:17 2002 (CST)
No Plan.
Additional info:
Finger RFC: ftp://ftp.isi.edu/in-notes/rfc1288.txt

You might want to use the StringTokenizer class to split the address supplied as a command line argument  into a username and an address.
 
 

Part 2: RMI based calculator

Implement a simple calculator using RMI. Since RMI is about communication between distributed objects, you'll need to implement a server and a client. The server should know how to add, subtract, multiply and divide two numbers. The client will get two numbers and an operator (specified through a character: '+', '-', '*', or '/') as command line arguments, send them to the server, and print the result returned  by server.  (Note:  to pass '*' as a command line argument  you might need to use quotes to prevent the shell to use it for filename substitution.)

Additional requirements (please keep in mind these are hard requirements):
import java.rmi.*;
import java.util.*;

public interface CalculatorServer extends Remote 
{
	public int compute(int op1, int o2, String operation) throws java.rmi.RemoteException;
}