Question: Implement a program in java that evaluates arithmetic expressions and communicates with another program, which acts as a log server. The program must have the
Implement a program in java that evaluates arithmetic expressions and communicates with another program, which acts as a log server. The program must have the following features:
- The program must accept input from the user.
- If the input represents a valid arithmetic expression, the expression should be evaluated, the result of the expression should be displayed to the user, and the arithmetic expression along with the result should be sent to the log server.
- If the input supplied by the user does not represent a valid arithmetic expression, the program should display the error message "Invalid expression: " followed by the reason for the invalid expression, and position the cursor to accept new input from the user.
- If the user inputs the command "print", the program must request the log server to print out the contents of the log file.
- The program should keep processing user input, until the user specifies the command "quit".
- At the very least, the program should accept expressions with the arithmetic operators: {+, -, *, /, ^} and perform the evaluation of the expression. The communication between the program that evaluates the arithmetic expressions and the log server should be based on sockets.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
