Develop a server program in Java that waits for clients to connect. The server responds to the client to choose one of the following options available with server and then deliver the requested object to client: Sum Multiply Division Bye Server Program is first started. Then the Client program is started. Ask three questions from Server Get the answer from client Finally send the resutls. Execute the following steps: Step 1: Run the Java program of Server Step 2: Run the Java program of Client and Sample output of Client Window: Sample output 1(Client): Connected to server Message from Server: Select the option: Sum Multiply Division Bye Enter the message to the server: 1 Reply from Server: What is the sum of 2 + 3 ? Enter the message to the server: 4 Reply from Server: Your Answer not correct Reply from Server: What is the sum of 4 + 3 ? Enter the message to the server: 7 Reply from Server: Your Answer correct, Congrats Reply from Server: What is the sum of 10 + 11 ? Enter the message to the server: 21 Reply from Server: Your Answer correct, Congrats and Total Correct 2 and Wrong 1, bye Sample output 2(Client): Connected to server Message from Server: Select the option: Sum Multiply Division Bye Enter the message to the server: 2 Reply from Server: What is the product of 4 * 3 ? Enter the message to the server: 11 Reply from Server: Your Answer not correct Reply from Server: What is the product of 10 * 3 ? Enter the message to the server: 30 Reply from Server: Your Answer correct, Correct Reply from Server: What is the product of 5 * 3 ? Enter the message to the server: 21 Reply from Server: Your Answer not correct and Total Correct 1 and Wrong 2, bye Sample output 1(Server): Connected to client socket number 13 Message to Client : Select the option: Sum Multiply Division Bye Client sent message: 1 Message to Client Server: What is the sum of 2 + 3 ? Answer from Client : 4 correct count : 0 Message to Client Server: What is the sum of 4 + 3 ? Answer from Client : 7 correct count : 1 Message to Client Server: What is the sum of 10 + 11 ? Answer from Client : 21 correct count : 2 Reply to client : Your Answer correct, Congrats and Total Correct 2 and Wrong 1, bye Task: 1. Write the Java socket program for the Server. (class name: Server_Your ID Number) Task: 2. Write the Java socket program for the Client. (class name: Client_Your ID Number) Task: 3. Execute the program and show the output screenshot.
Develop a server program in Java that waits for clients to connect.
The server responds to the client to choose one of the following options available with
server and then deliver the requested object to client:
Sum
Multiply
Division
Bye
Server Program is first started.
Then the Client program is started.
Ask three questions from Server
Get the answer from client
Finally send the resutls.
Execute the following steps:
Step 1: Run the Java program of Server
Step 2: Run the Java program of Client and Sample output of Client Window:
Sample output 1(Client):
Connected to server
Message from Server: Select the option:
Sum
Multiply
Division
Bye
Enter the message to the server: 1
Reply from Server: What is the sum of 2 + 3 ?
Enter the message to the server: 4
Reply from Server: Your Answer not correct
Reply from Server: What is the sum of 4 + 3 ?
Enter the message to the server: 7
Reply from Server: Your Answer correct, Congrats
Reply from Server: What is the sum of 10 + 11 ?
Enter the message to the server: 21
Reply from Server: Your Answer correct, Congrats and Total Correct 2
and Wrong 1, bye
Sample output 2(Client):
Connected to server
Message from Server: Select the option:
Sum
Multiply
Division
Bye
Enter the message to the server: 2
Reply from Server: What is the product of 4 * 3 ?
Enter the message to the server: 11
Reply from Server: Your Answer not correct
Reply from Server: What is the product of 10 * 3 ?
Enter the message to the server: 30
Reply from Server: Your Answer correct, Correct
Reply from Server: What is the product of 5 * 3 ?
Enter the message to the server: 21
Reply from Server: Your Answer not correct and Total Correct 1 and
Wrong 2, bye
Sample output 1(Server):
Connected to client socket number 13
Message to Client : Select the option:
Sum
Multiply
Division
Bye
Client sent message: 1
Message to Client Server: What is the sum of 2 + 3 ?
Answer from Client : 4
correct count : 0
Message to Client Server: What is the sum of 4 + 3 ?
Answer from Client : 7
correct count : 1
Message to Client Server: What is the sum of 10 + 11 ?
Answer from Client : 21
correct count : 2
Reply to client : Your Answer correct, Congrats and Total Correct 2
and Wrong 1, bye
Task: 1. Write the Java socket program for the Server. (class name: Server_Your ID Number)
Task: 2. Write the Java socket program for the Client. (class name: Client_Your ID Number)
Task: 3. Execute the program and show the output screenshot.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps