Java Project
Java Project
Objective of this assignment is to write a simple client-server network application using the Remote Procedure Call (RPC)
or the Remote Method Invocation (RMI) system. Description:
You will write a simple air-ticket reservation system, using RPC/RMI mechanism. The reservation server (rsvserver)
maintains the seat availability information and responds to client requests for reservation or availability. For simplicity, we
are concerned about one flight on one date only. The reservation information will be maintained only in memory, no need
to maintain a persistent database.
The flight contains 30 seats, 5 of business class and 25 of economy class. Price of ticket is a function of availability-
Seats are numbered 1-5 for business class and 6-30 for economy class. For a particular class, the airline always sells
tickets at lowest available price.
The reservation client (rsvclient) interacts with user and sends requests to the server based on user input. User input is
taken as command line parameters, output is printed on the screen as text. In particular, the client may send the following
requests to the server.
lists all available seats in different classes and price ranges. For example, if there is 3 business class seats and 7 economy
class seats available, the output is –
business class: 1
seats at $500 each
2 seats at $800 each
Seat numbers: 3,6,9
economy class: 2
seats at $300 each
5 seats at $450 each
Seat numbers: 18,22,25,26,28,29,30
rsvclient reserve <server_name> <class> <passenger_name> <seat_number>
reserves the particular seat of the particular class for the particular passenger. Assume passenger name to be a single string
without space. Class name is either “business” or “economy”. Request may fail if invalid seat number is provided
(economy class seat number for business class reservation), or the given seat number is already sold.
Possible outputs
Alice business 2
Bruce business 5
Melissa economy 10
John economy 12
Eric economy 13 Implementation
details:
You will implement both the rsvclient and the rsvserver program using either RPC or RMI. If you are more
familiar with C, use RPC, or, if Java is your favorite, use RMI. Your rsvclient should handle all the three user
requests. The rsvserver should maintain the reservation state and respond to the requests from the client pertaining
to all the three functions.