Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a multithreaded Java server which has the following properties: It listens to requests at port 12345. When a request arrives: o It creates a

image text in transcribed

Write a multithreaded Java server which has the following properties: It listens to requests at port 12345. When a request arrives: o It creates a new thread to serve the request. o The client sends in a double array, which stored three floating-point numbers, to the server with the writeObject method of ObjectOutputStream. The three elements in the array represent the three known numbers (a, b and c) of a quadratic equation: ax+bx+c = 0 The server then calculates the roots of the quadratic equation with the following formula: - 1 - 4ac 2a o If there is no real root, i.e., b2 - 4ac 50. a null value will sent to the client with the writeObject method of ObjectOutputStream. o Otherwise, the two roots of the quadratic equation are stored in a double array and sent to the client with the writeObject method of ObjectOutputStream. O After that, the server will close the connection. Note that you only need to provide the implementation for the server, not the client. Hint: Result of square root can be obtained by using method Math.sqrt(double a)

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

Databases Organizing Information Digital And Information Literacy

Authors: Greg Roza

1st Edition

1448805929, 978-1448805921

More Books

Students also viewed these Databases questions

Question

Describe the patterns of business communication.

Answered: 1 week ago

Question

3. Provide two explanations for the effects of mass media

Answered: 1 week ago