Question: use java language~thank you Write a program named MathInteract that receives two double values, num1 and num2, from the user and then interacts with the

 use java language~thank you Write a program named MathInteract that receives

use java language~thank you

Write a program named MathInteract that receives two double values, num1 and num2, from the user and then interacts with the user to do the following using either a do-while loop or a while-loop The program prints the prompt "Enter an operation: ". * The program receives a token from the user According to the value of the token the program performs the following: If the token is equal to "+", "-", "*", "/", or "%", the program prints in one line the value of num1 + num2, num1 -num2, num1 * num2, num1 / num2, and num1 % num2, respectively. Otherwise, the program terminates the loop In writing the code, use a switch-statement creatively: * Use tive case entry points to perform selectively the five mathematical operations. Use default to replace the token with some special String literal, in the case where the token does not match any of the five After the switch-statement, there are only six possible values for the token. Use the comparison of the token with the default value to determine whether to terminate the loop. Also, use printf to print exactly 8 digits after the decimal point when reporting the result of calculation For example, the program may behave as follows: 1 | % java Math!nteract 2Enter two real numbers: 98.5 33.4 3Enter operation: + 4131.90000000

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!