In Progress

Java RMI lorrery

Use Java RMI to write a simple client-server application to play a Lottery. The player should select 6 distinct numbers in the range 1-50 and wins if any one of those numbers matches the single number generated at random on the server.

The objectives of this coursework are to:

• Write a program to play Lotto according to the rules above.

• Understand the invocation of methods on remote objects.

• Understand the production of distributed Java objects.

Summary of the Work

You will have to:

• Define the remote methods to allow the client to send the numbers to the server.

• Implement these methods as a remote object.

• Write a client to invoke the remote methods.

• Use the rmic program to produce a stub and a skeleton.

• Use the rmiregistry tool to register the server.

• Programming

• Defining the Interface

In this coursework, firstly you define the server methods. The Lotto server receives and

reads the list of numbers selected by the client. Then it checks that this list is valid

(distinct numbers in the range 1-50):

• If not, return an error message to the client.

• If yes, make the lottery draw and see if the client has any winning

numbers. Return the result to the client.


The server is comprised of an interface and a class. The interface provides the definition for the methods that can be called from the client. Essentially the interface defines the client's view of the remote object. The class provides the implementation. Define these methods in a Java LottoInfo interface. Derive the interface from the Remote class or from [url removed, login to view] interface (The interface must extend from java.rmi.Remote. All the method declarations must include the throws [url removed, login to view] clause).

Implementing the Remote Objects on the Server

Write the LottoInfoImpl class that implements the LottoInfo interface and the

LottoServer class that creates an object and registers it on the server.

1. Write the LottoInfoImpl class that contains the actual methods to receive the numbers.

2. Derive the class from the UnicastRemoteObject class

3. Create a LottoServer class with a method that creates a object. Register this object with the RMI remote object registry, name and bind it to a port using the Naming class and the rebind() method.

Programming the Client

Produce the LottoClient class that locates the server and invokes the remote methods. The command to start the client will be $ java LottoClient rmi://machine/remote_object

Where the URL refers to the registry(usually on the same machine that the server runs on, probably localhost).

Retrieve the remote object using the Naming class, by passing the use of the registry to the lookup() method. Then make the remote method call on this object. Producing the Distributed Objects

Finally, compile and run the distributed objects.

1. Compile all the classes you have written.

2. Your RMI java programs are only a part of the application. It uses two other pieces of code called the stub and the skeleton. These reformat the method parameters and encapsulate them into a RMI data unit. This process is called marshalling. Run the command rmic LottoInfoImpl to generate the stub and the skeleton.

3. Launch the registry rmiregistry. Be sure to run the registry in the RMI server directory that contains the stub and skeleton.

4. Run the server and the client on a same machine and directory. Then try to run the client and the server on two different machines.

Skills: Java, Software Architecture

See more: simple program rmi lottery application java, encapsulate rmi data unit, start java programming, single view application, reformat data, programming io remote, programming definition, programming class definition, production tool, method programming, matches list, list matches, java server programming, java programming classes, java lottery application, definition of programming, defining you, define send, c generate random number in range, architecture define, application programming interface definition, java client server application play lottery, java programming software, java programming class, architecture programs

About the Employer:
( 0 reviews ) Barking, United Kingdom

Project ID: #1479597

Awarded to:


Hi, kindly check your inbox for my inquiries. Thanks.

£20 GBP in 0 days
(208 Reviews)

5 freelancers are bidding on average £74 for this job


I am capable of doing this assignment. Please select my bid.

£100 GBP in 1 day
(304 Reviews)

I have already done [url removed, login to view] check the PMKindly see the attached file it might help you because i have already implemented a Student Server Score Application in Java Using RMI.

£30 GBP in 1 day
(3 Reviews)

i have already worked in such projects. i have experience.

£20 GBP in 1 day
(0 Reviews)

I have good experience in Java SE. I think I can deliver this project in proper time.

£200 GBP in 2 days
(0 Reviews)