Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please write code Program Name: Emily.java Input File: emily,dat. Emily needs your help writing a program that reads in a simple mathematical expression consiating of
Please write code
Program Name: Emily.java Input File: emily,dat. Emily needs your help writing a program that reads in a simple mathematical expression consiating of an intoger operand, a binary operator, and another integer operand. The program should calculate the result of the mathematical eperation and display. it to the console: Valid binary operators are: - + (performs addition) - - (performs subtraction) - X,x, and " (performs multiplication) - (performs division) Input: Input will consist of an integer N, the number of test cases. The number of test cases will be in range [1,20], Each subsequent line will contain the mathematical expression of the form: "operand1 + operand2", "operand1 - operand2". "operand1 X operand2", "operand1 x operand2", "operand1 " operand2", or "operand1 / operand2", operand1 and operand2 are guaranteed to be integers in range of [255,255]. There will be a guaranteed space between operandl and the binary operator, as well as a guaranteed space between the binary operator and operand2. Note: the input will never consist of division by 0 and the remainder will be guaranteed to be a nonnegative number. Output: For each mathematical expression, you are to output the original mathematical expression followed by a space, an equal sign, a space, and the result of the operation. For the division case only, you are to output the result of the integer division followed by a space, "remainder", space and the remainder of the division that was performed. See the Sample output. Sample input: 71+25143869420/640/10 Sample output: 1+2=351=443=1286=4894=3620/6=3remainder240/10=4remainder0 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