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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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