Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using Java RMI, write an application for a prototype opinion poll system. Assume

ID: 3684256 • Letter: U

Question

Using Java 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 transient memory), and provide the current counts to those who are interested.

Write the interface file first. It should provide remote methods for accepting a response to the poll, providing the current counts (e.g., “10 yes, 2 no, 5 don’t care”) only when the client requests it.

Design and implement a server to

Export the remote methods, and

Maintain the state information (the counts). Note that the updates of the counts should be protected with mutual exclusion.

Design and implement a client application to provide a user interface for accepting a response and/or a request, and to interact with the server appropriately via remote method invocations.

Explanation / Answer

Question:

Using Java 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 transient memory), and provide the current counts to those who are interested.

Note:
You do not need to make a number of client programs. Make one server and one client programs. Keep the server running and run the client several times. For example I run the client three times as follows. Note that this is just a sample example. Your answer must work for any number of clients.

Server Side:

import
java.rmi.*;
import java.rmi.server.*;
import java.rmi.registry.Registry;
import java.rmi.registry.LocateRegistry;
import java.net.*;

public class Chapter7Problem9Server{
             public static void main(String args[]){

      }

}

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

import java.rmi.*;
import java.rmi.server.*;

public class VoteServerImpl extends UnicastRemoteObject implements VoteServerInterface

{

}

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

import java.rmi.Remote;

public interface VoteServerInterface extends Remote {

       public String castVote(char vote )throws java.rmi.RemoteException;

}

Client Side:

import java.rmi.*;
import java.util.*;

public class Chapter7Problem9Client{

public static void main(String args[]){

}

}

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

import java.rmi.Remote;

public interface VoteServerInterface extends Remote {

       public String castVote(char vote )throws java.rmi.RemoteException;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote