Using RMI, write an application for a prototype opinion poll system. Assume that only one issue is being polled. Respondents may choose yes, no , or don't care. Write a server application to accept the votes, keep the tally (in memory), and provide the current counts to those who are interested.

What will be an ideal response?


The Server Interface is as follows:
```
// @param vote – ‘Y’ or ‘N’
// @return a string containing the tallies of the votes
public String castVote(char vote )
throws java.rmi.RemoteException;

}
```

```
The server object implementation is as follows:
import java.rmi.*;
import java.rmi.server.*;
import java.util.Vector;

/**
* This class implements the remote interface
* CallbackServerInterface.
* @author M. L. Liu
*/

public class VoteServerImpl extends UnicastRemoteObject
implements VoteServerInterface {

private Vector clientList;
private int yesCount, noCount;


public VoteServerImpl() throws RemoteException {
super( );
yesCount = 0;
noCount = 0;
}

public String castVote(char vote )
throws java.rmi.RemoteException {
if (vote == 'Y')
yesCount++;
else
noCount++;
return (“Yes = “ + yesCount + “; No = “ + noCount);
}
}// end VoteServerImpl class
```

Computer Science & Information Technology

You might also like to view...

It's a smart idea to save repetitive steps as a(n) ____, thereby avoiding time consuming repetition of efforts.

A. agenda B. action C. list item D. story

Computer Science & Information Technology

____ satellites travel at a speed and direction that keeps pace with the earth's rotation, so they appear (from earth) to remain stationary over a given spot.

A. Microwave B. Geosynchronous C. Isochronous D. Full-duplex transmission

Computer Science & Information Technology

Agnes has been using XQuery to design queries using path expressions. Her next project will involve multiple source documents and require more complicated criteria. She has heard that a FLWOR structure could be effective for such cases, and comes to you for assistance in developing a FLWOR structure query. Agnes has heard that one of the clauses in a FLWOR structure is used to iterate through a sequence of nodes or atomic values. You tell her that she is describing the _____ clause.

A. ?for B. ?let C. ?where D. ?return

Computer Science & Information Technology

When Photoshop launches, it does not open a photo by default.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology