Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can you help me with just Sort_A? please and Thank you In this assignment, you will update both client and server projects with an interactive

image text in transcribedimage text in transcribed

image text in transcribed

Can you help me with just Sort_A? please and Thank you

In this assignment, you will update both client and server projects with an interactive communication scenario, where a user (at the client side) can enter a command through the terminal then waits for a response back from the server to be able to send another command. The server handles the received commands and return appropriate results. - The server keeps a list (Dynamic-size ArrayList or Static-size Array) of integers (initially empty or filled with zeros) and named inputValues to handle (add/remove) commands. If you use ArrayList option you can use the different APIs to add/remove elements. If you use array option, so to add an element, you can replace the first zero with the new element. If you use array option, so to remove an element, replace it with zero. - The client initially prints a list of the supported commands for the user to write correct formatted command. - The client then types one of the supported commands before clicking Enter. - If a user sends any other command or a supported command but in a different format, the server should ignore the command and respond with "unsupported command" without exiting either the client or the server. The following table contains the different supported commands that a user can initiate, along with the proper handle from the server side and the expected response per command. The client hosts the user-interface layer where the user can send command(s) to the server. The server hosts both the processing and data layers to handle the incoming commands from the client side on stored data. The data layer at the server side keeps a dynamic list (ArrayList) of integers (initially empty) named as inputValues to handle (add/remove) data to/from the user. The user at the client side enters a command through the terminal (e.g., of your IDE) and then waits for a response back from the server to be able to enter another command. The following table shows the different supported commands that the user can send to the server side, along with the proper handle from the server side and expected responses. The client side should print a list of the supported commands to the user to help them write the correct formatted command. If the user sends any other command or a supported command, but in a different format, the server should ignore the received message and respond with "unsupported command" without exiting either the client or the server. A command from the client to the server is a JSON object, with a unique identifier as the key and the actual instruction as the value. A response from the server to the client is also a JSON object, with the identifier of the instruction as the key and the result as the value. For example: - If the user wants to add the number 80 to the server's list, the user types "Add: 80 " and clicks enter. - The client builds JSON-based command: { "Instruction 1": "Add: 80 " }. - The server executes the instruction and responds with the following JSON-based response: \{"Instruction 1": "added successfully"' - If the user wants to display the sorted version of the values from the server's list, the user types "Sort_A" and clicks enter. - The client builds the following JSON-based command: { "Instruction 2": "Sort_A" }. - The server then executes the instruction and responds with the following JSON-based response: \{"Instruction 2": "The sorted list is {10,20,30,40}} 1- Sort the values in the inputValues list in ascending order 2- Respond with "The sorted list is {x,y,.z} " where x,y, and z are elements in the list. If empty list or all elements are zeros, the message holds \{null\}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial Databases 2nd Symposium Ssd 91 Zurich Switzerland August 1991 Proceedings Lncs 525

Authors: Oliver Gunther ,Hans-Jorg Schek

1st Edition

3540544143, 978-3540544142

More Books

Students also viewed these Databases questions