Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can someone please help me with this homework assignment. Using Java to demonstrate the use of sockets and must answer all parts. Please and thank
Can someone please help me with this homework assignment. Using Java to demonstrate the use of sockets and must answer all parts. Please and thank you
Must be in JAVA and answer all parts please. Include ScreenShots
Simple Calculation Services via Network In this project, you are required to implement a network application, which consists of a server and one or more clients. The server will provide simple calculation services to the clients). You should use both UDP sockets and TCP sockets to implement the communications between the server and the client s). Behavior on the client side: 1. The client program should be able to run in a forever while loop, so that the user can send as 2. The client can input a math expression that it wants to calculate, such as "50100", "50 100 3. In each iteration of the while loop, the client program should provide two choices for the user: many calculation requests as he/she wants. etc. 1.) terminate the program, indicating that the user no longer needs to do any calculation this time. 2.) continue to input math expressions. This is like providing a menu for the user. You don't need to design Graphic User Interface (GUI). The client program can just print out some instructions for the user, and determine what the user wants according to the user's input. The math expression is input as a string. You need to send the calculation request to the Simple Calculator Server using UDP socket and TCP socket. In this aspect, the message sending process is very similar to the example application we discussed in class. 4. 5. If the user explicitly indicates that he/she wants to exit the program, the program should properly close any socket previously used for communications. Behavior on the server side: The server should have a while loop that can continuously accept calculation requests. Server should understand at least the four operators, i.e., *,-. *, and /, when they appear alone Expressions are received as strings. Example expressions: "40 50", "20 - 100", "10 20, "100/ 1000". It should be flexible enough such that if the expressions are reasonable, they should be considered valid and accepted. For example, these expressions:40-50 ". "40 50 and "40+50", are a valid and should be accepted. That is, adding or removing arbitrary spaces anywhere in the expression shuldn't be a problem. The result of a calculation request will be sent back to the corresponding requester as a string, which represents a number The server should be able to serve multiple clients, at least one client by one client. 1. 2. 3. 4. Simple Calculation Services via Network In this project, you are required to implement a network application, which consists of a server and one or more clients. The server will provide simple calculation services to the clients). You should use both UDP sockets and TCP sockets to implement the communications between the server and the client s). Behavior on the client side: 1. The client program should be able to run in a forever while loop, so that the user can send as 2. The client can input a math expression that it wants to calculate, such as "50100", "50 100 3. In each iteration of the while loop, the client program should provide two choices for the user: many calculation requests as he/she wants. etc. 1.) terminate the program, indicating that the user no longer needs to do any calculation this time. 2.) continue to input math expressions. This is like providing a menu for the user. You don't need to design Graphic User Interface (GUI). The client program can just print out some instructions for the user, and determine what the user wants according to the user's input. The math expression is input as a string. You need to send the calculation request to the Simple Calculator Server using UDP socket and TCP socket. In this aspect, the message sending process is very similar to the example application we discussed in class. 4. 5. If the user explicitly indicates that he/she wants to exit the program, the program should properly close any socket previously used for communications. Behavior on the server side: The server should have a while loop that can continuously accept calculation requests. Server should understand at least the four operators, i.e., *,-. *, and /, when they appear alone Expressions are received as strings. Example expressions: "40 50", "20 - 100", "10 20, "100/ 1000". It should be flexible enough such that if the expressions are reasonable, they should be considered valid and accepted. For example, these expressions:40-50 ". "40 50 and "40+50", are a valid and should be accepted. That is, adding or removing arbitrary spaces anywhere in the expression shuldn't be a problem. The result of a calculation request will be sent back to the corresponding requester as a string, which represents a number The server should be able to serve multiple clients, at least one client by one client. 1. 2. 3. 4
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started