Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program to evaluate the following expressions and print out the results. Your program should store the result into a variable and then print
Write a program to evaluate the following expressions and print out the results. Your program should store the result into a variable and then print out the variable. Make sure to select the proper type of variable (String/int/double/etc) Hint: while not required, I would suggest that you try to predict the answer to each one before it prints out for practice. For example, the answer to the first line would be String answer0 = 3 + "2"; System.out.println(answer0); int answer1 = 3 - 1; System.out.println(answer1); --------------------------------------------- * 3 - 1 * 2 + 2 + 3 + 4 * 2 + 2 + 3.1 + 4 * 2 + " 2 + 3 " + 4 * 3 + 4 + " 2 + 2" * 2 + 2 + (3 / 4) * (12 / 2) + (13 / 4.0) * "hello" + 2 * 4 * 2 + 2.0 + 2 * 2 + 2 * 4 + 1 + 9 + .01 + (-3 + 10) + 11 / 3 * 8 + 16 / 5 + 4 + 0 + 12 / 5.0 * 1 + 1 + (8 - 2) * 1 + 1 * 5 + 2 + "(1 + 1)" + 4 + 2 * 3 * "1" + 2 + 3 + "4" + 5 * 6 + "7" + (8 + 9) could anybody do these to have certan answers?
Write a program to evaluate the following expressions and print out the results.
Your program should store the result into a variable and then print out the variable. Make sure to select the proper type of variable (String/int/double/etc)
Hint: while not required, I would suggest that you try to predict the answer to each one before it prints out for practice.
For example, the answer to the first line would be
String answer0 = 3 + "2";
System.out.println(answer0);
int answer1 = 3 - 1;
System.out.println(answer1);
---------------------------------------------
* 3 - 1
* 2 + 2 + 3 + 4
* 2 + 2 + 3.1 + 4
* 2 + " 2 + 3 " + 4
* 3 + 4 + " 2 + 2"
* 2 + 2 + (3 / 4)
* (12 / 2) + (13 / 4.0)
* "hello" + 2 * 4
* 2 + 2.0 + 2 * 2 + 2
* 4 + 1 + 9 + .01 + (-3 + 10) + 11 / 3
* 8 + 16 / 5 + 4 + 0 + 12 / 5.0
* 1 + 1 + (8 - 2) * 1 + 1
* 5 + 2 + "(1 + 1)" + 4 + 2 * 3
* "1" + 2 + 3 + "4" + 5 * 6 + "7" + (8 + 9)
could anybody do these to have certan answers?
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