Create a string that describes the outcome of the game

Assignment Help Computer Engineering
Reference no: EM132170658

Using Java: First, the setup. Create a Server and a Client. The Server will accept two Clients when it starts.

Then, we're going to assign an ID to both Clients. Once we have this setup, the Server is going to play a guessing game with the Clients.

The Server will randomly pick a number between 1 and 10, and then it will get a guess from each Client. Each Client will accept a numeric entry between 1 and 10 from the user and send their entry to the Server.

Don't forget to use Data Validation and ask for a new entry without terminating the program if invalid data is entered. When the Server has received both entries, it will determine a winner and send a confirmation to both Clients.

Everything will then finish and disconnect. While this may sound complex, there are several ways to keep this program simple. Once both IDs have been sent, get an integer from each Client and have the Server receive them one at a time.

Then, compare both numbers to the chosen number and decide which player won or if it is a tie (in the case that both players' choices are the same distance from the server's chosen number - i.e. if the Server chose 5 and the users chose 3 and 7).

Create a String that describes the outcome of the game like shown below and send that to both Clients. This will be enough to finish execution. "Player 1 chose 2. Player 2 chose 7.

The Server chose 3. Player 1 wins!" To summarize, your program should do the following: Create a Server class and a Client class. Have two Clients connect to the Server. Have the Server send an ID to both Clients. Have the Server choose a random number from 1 to 10 for a guessing game.

Allow both Clients to get user-input in the form of a number. Perform entry validation to ensure that each entry is an integer between 1 and 10, prompting for a re-entry without terminating the program if the input is invalid. Send both user entries back to the Server. Determine which user chose a number closest to the Server's target number.

Send a String with an outcome message to both Clients. Disconnect and close everything.

Reference no: EM132170658

Questions Cloud

Write a program that prompts the user for a radius : Write a program that prompts the user for a radius and height of a cylinder and uses a method to calculate the surface area.
Main economic issues in the health care system : What are some main economic issues in the health care system and how do you try to minimize them?
Determine the price-quantity combination : You are the manager of BTN LTD. In order to have a clear picture on how the firm operates and what is the total demand by the consumer
Capital model and signaling model : Both human capital model and signaling model predict that more intellectual people tend to have more education in equilibrium.
Create a string that describes the outcome of the game : Create a String that describes the outcome of the game like shown below and send that to both Clients.
Same organizational structure or a different one : Are competitors of Ford Motor Company using the same organizational structure or a different one?
What is the standard deviation of the number of houses : What is the standard deviation of the number of houses with a DVD?
Write a program for a given an input integer array : Using java ,write a program for a given an input integer array, lower bound lb and upper bound ub.
Using java write a recursive method static int intsquareroot : Using java Write a recursive method static int intSquareRoot(int n) {} // return the biggest number whose square is = 0.

Reviews

Write a Review

Computer Engineering Questions & Answers

  What are the advantages if any in using udp rather than tcp

q1 what are the merits if any in using udp instead of tcp when transferring large objects across the network?q2 where

  Finalizenbspwork on the

finalizenbspwork on the microsoftregnbsppowerpointregnbspslide presentation updating it with new information based on

  Draw a block diagram indicating the system functions

Draw a block diagram indicating the system functions. Draw blocks for the system controller, the steering servo, and the car dynamics.

  Make use to effectively manage a team of system

Are different management techniques needed for managing technical personnel versus nontechnical personnel.

  Too much control is counter-productive define

"Too much control is counter-productive." Do you agree? Provide reasoning of the view.

  Why systems modeling is worth the time and resources involve

Suppose you are starting work on a project for an organization that has never used any modeling techniques or tools in designing a system.

  Write the xhtml for a three-column table

Write the XHTML for a three-column table to describe the courses you are taking this semester.

  Perform the affine mapping by computing the matrix-vector

Perform the affine mapping by computing the matrix-vector multiplication and addition.

  Query using an update statement

Here is issue, a table namedPoints varchar(81) has values stored in a column named Point. There are two columns in the Points table, X and Y.

  Discuss a recent security breach or cyberattack

Find an article on the WWW that discusses a recent (within the last 2 years) security breach or Cyberattack. Provide a link to the article and suggest.

  Prepare a multithreaded code breaking program

Prepare a  multithreaded code breaking program. You have been provided 3 files that contain text that have been  encrypted using a Caeser cypher scheme.

  How many page frames does physical memory have

A process of a system has a virtual memory space of 4096 words or addresses with a page size of 64 words. There are 16 blocks in the main memory with 16 words per block. How many page frames does physical memory have?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd