Calculator Server and Client  Java  The goal: Make a client that sends simple arithmetic expressions, and a server that solves them and sends the result

Calculator Server and Client  Java 

The goal: Make a client that sends simple arithmetic expressions, and a server that solves them and sends the result back to the client. 

Class design requirements: 

Your program should contain at least the following classes • CalculatorClient • CalculatorServer Important note: This is an unusual project in that it does not require a Tester class! I will run your two classes myself, calculatorolient and calculatorserver, and test them. 

Each of your classes, CalculatorClient and CalculatorServer, should have main(String[] args) methods, allowing them to be run! Thus, they will never actually be instantiated; they will just run. 

Here are the requirements for each class: CalculatorServer: • Makes a ServerSocket that awaits a connection on a port of your choice. • When a connection is made, it sends a one-time welcome message to the connected socket. 

• Repeatedly awaits data from the connected socket in the form <double> <operator> <double>, where <double> is a string that can be parsed to a Java Double data type, and <operator> is a string that is either “+”, “-“, “r, or “*”, representing addition, subtraction, division, or multiplication, respectively. • When data of this form is received, representing an arithmetic calculation to be made, actually does the calculation and sends the result back to the connecting socket. 

CalculatorClient: 

• Makes a Socket that connects to some port of your choice on the host “localhost”. This port should match that of the server! 

• Repeatedly asks the user for input, and sends that input over the socket connection to the server. 

• When a response is received (which should be the solution to the arithmetic problem), prints that to the console. 

Note: It’s okay in this case for your server or client to crash if the client sends data in the wrong format (for example, if the client sent the string “5+5” with no spaces, or the string “foo”). You will not be marked down for this occurring. 

Share This Post

Email
WhatsApp
Facebook
Twitter
LinkedIn
Pinterest
Reddit

Order a Similar Paper and get 15% Discount on your First Order

Related Questions

Accounting: Business and finance: computerscience: Economics: Marketing: Social Science Am a professional academic writer, content creator and, copywriter

Accounting: Business and finance: computerscience: Economics: Marketing: Social Science Am a professional academic writer, content creator and, copywriter with 7 years of research based experience. My passion for research, writing, and editin g makes me the perfect professional for varying topics in Studydaddy. I understand the value of detailed research

BYOD Registration Form Resources To complete this project, you may need to review instructions on how to take a screenshot.   Locate System

BYOD Registration Form Resources To complete this project, you may need to review instructions on how to take a screenshot.   Locate System Information Review this resource to check how to locate your system information.   Template Use the BYOD Ingest Form Template to complete the project. Delete the instructional text from the template before you submit.    2024 University of

Topic: Computer ScienceDistributed Database Management Systems (DDBMS), is the next generation of Database Management Systems, where the data is stored at

Topic: Computer ScienceDistributed Database Management Systems (DDBMS), is the next generation of Database Management Systems, where the data is stored at several geographical locations, but from the user or application perspective, it is still one Database. These are the advantages of this paradigm: enlarged availability and reliability of data, and

In this part, you are asked to explore and/or investigate distributed database management system (DDBMS). You can either explore the main concepts or

In this part, you are asked to explore and/or investigate distributed database management system (DDBMS). You can either explore the main concepts or technical challenges of DDBMS in general (without directly specifying a certain DBMS) or you can research a specific DBMS and present how it manages different aspects of distribution. Your exploration or

**Tutorial: Introduction to Graph Theory** **Category:** Computer Science **Details:** Graph theory is a foundational concept in computer science and

**Tutorial: Introduction to Graph Theory** **Category:** Computer Science **Details:** Graph theory is a foundational concept in computer science and mathematics, focusing on the study of graphs, which are structures consisting of nodes (vertices) and edges (connections between nodes). This tutorial provides a comprehensive introduction to graph theory, covering essential topics

Tunneling in VPN refers to securely transmitting data across the internet by encapsulating it within another packet, resulting in a “tunnel.” This process

Tunneling in VPN refers to securely transmitting data across the internet by encapsulating it within another packet, resulting in a “tunnel.” This process ensures privacy and security by preventing unauthorized access to data during transmission. Common tunneling protocols include PPTP, L2TP, and OpenVPN, which help to ensure data confidentiality and