In this exercise you will create a server program that guesses numbers using bin
ID: 3683419 • Letter: I
Question
In this exercise you will create a server program that guesses numbers using binary search. A game is played each time a client contacts the server. Clients choose will choose a lower boundary between 0 and 200. The upper boundary will be the lower boundary plus 300. Figure 2 shows the flow of messages issued by the client (in green) and your server (in blue). When contacted, the server receives a message with 2 random numbers, indicating the lower and upper boundaries of the list (for example, "37 337". The server then replies with a guess (for example, "187") and receives from the client either a "high", "low", "won" or "lost" message. The first two replies indicate that more tries are allowed; the last two indicate that the game is over: it has been either won (the number was guessed) or lost (which should never happen using binary search). The connection between client and server ends when the game is over. Follow the steps below to implement your server program. Create a Lab07 project. Create a class GuessingServer implementing your server program. The class should implement a main method where the server creates a socket connection at port 5150 to await for clients. The server should play the guessing game with any numbers of sequential clients. The server runs continuously until a client connects and sends "SHUT DOWN" as its initial message. Download the JUnit test file GuessingServerTest.java from the class website and import it into the project. Test your server using its test cases.Explanation / Answer
/**** GuessingServerTest.java ****/
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.