Server Program

Complete Lab 3 –Rental Car Client/Server. A complete set of instructions can be found in the Lab Overview under Week 3.

This week’s assignment is to design and build a rental car management system using TCP and appropriate data streams. This is a multipart assignment. In the last phase of this assignment, you will have the opportunity to add threads and synchronization to this application. The application will be a rental car inventory management system. Cars can be added to the pool of cars available to rent. A car can be rented, and a car can be returned after rental. Any employee at the rental agency can do any one of these operations. More than one employee is expected to be performing these operations at the same time, so access to the information about the car inventory will need to be synchronized (when threads are added).
Required data per vehicle:

  • ID number which uniquely identifies it (i.e., VIN).
  • Year / Make / Model info (i.e., 2004 Toyota Camry)
  • Rental Type – Truck, Luxury Car, Mid-size Car, Compact Car
  • Mileage at Last Check-out or Check-in
  • Rental Status: Available, Rented
  • Renter’s Name and Driver’s License Number

Server inventory data:

  • List of rented and available vehicles in the current inventory.

Output

Submit a Word document which contains the following: the written description of the message exchange from phase 1, the Message class code from Phase 1, screen shots of the output of both the client and the server programs from Phase 2, and your source code for the client and server from Phase 2.

Benefits

Understand how the client/server architecture is implemented and works.

iLAB STEPS

Implementation

The following phases should be implemented for this week:

Phase 1: Design the message exchange between the client and the server. For each of the operations described in this document, specify the details of what values the client sends to the server and what possible values the server sends back to the client. Make sure you consider any error returns from the server. Design your Message class based on this specification. Turn in a short written description of the Message exchange and your Message class source code. Your written description should be no more than one page.

Phase 2: Implement the TCP and Object stream network communication between the client and server. At this point, you should be able to send message objects between the client and the server and vice versa. Have your client sending a real addget, rent, and return message. The server should display the contents of the received message, and return a message indicating the requested operation failed. The client should display the returned message content appropriately. Turn in screen shots of the client and server which illustrate the message exchange. Also turn in your client and server source code.

The following operations should be implemented on the server side:

  1. Add Vehicle: the client must provide a unique ID number, the year – make – model info, the type of rental vehicle, and the current mileage. The server will add a new vehicle to its list of available vehicles. The server should verify that the VIN is unique. The client should receive an indication of success or failure from the server.
  2. Get Vehicle Data: the client can request to see the next vehicle’s data. The client must specify a state (i.e., Available, Rented, Any) and a specific rental type (i.e., SUV, Truck, Any). The server must keep track of the client’s position when scanning through the inventory. The server returns the next vehicle’s data which matches the requested search criteria along with any rental information. If nothing matches, the server returns a failure indication to the client.
  3. Rent Vehicle: the client must provide the ID number of the vehicle being rented, along with the renter’s name and driver’s license number. The server must check to make sure the requested vehicle is available, and if so, places the vehicle into the rented state. The server returns an indication of success or failure to the client.
  4. Return Vehicle: the client must provide the ID number of the vehicle being returned, along with the current mileage of the vehicle. The server updates the vehicle’s inventory data accordingly, returning the vehicle to the available state. If successful, the server returns the miles driven by the renter. Otherwise, an error indication is returned.

User interfaces
Some of the source code that is required for the development of the client side GUI has been provided. The CarInventoryClient.java file is set up to be part of the default package of a CarInventoryClient project. This means that you need to create a project called CarInventoryClient, and copy the CarInventoryClient.java file into that folder. All other classes needed for the client should be part of this project.

Do you need help with this assignment or any other? We got you! Place your order and leave the rest to our experts.

Quality Guaranteed

Any Deadline

No Plagiarism