Question: 2. (10 points; 2 points each) Assuming that the declarations below were made before each part, find the value of result for each expression below.

2. (10 points; 2 points each) Assuming that the declarations below were made before each part, find the value of result for each expression below. If the expression is not legal in Java, say so Pay attention to the difference between int and double. Make sure the assignment statement is legal. Show your work in the box to obtain partial credit. Decimals should be shown to three digits. int dog - 10; double canine = 2.1 int cat = 23; double feline 4.3; a. int result dog + cat canine; b. double result dog / (int) canine; C. double result = cat/canine feline; d. double result dog + cat + feline / 3.0; e. double result = catfeline / dog canine; 1. (10 points; 1 point each) Perform each of the calculations below, and put the result in the box to the right. Pay careful attention to the difference between int and double (whether or not there is a decimal point) and String and char (whether there are single or double quotes). If the operation cannot be performed or does not make sense, say so. a. 4+ 13 'b. 5-3.7 C. 2 + 13/3 d. 9/3.0 + 4 e. 7/3 +8 f. "6" + "12" NO 8. (int) 8.995 h. 7.5 + 11/15 + 5 1. 7.5 * 11/15 +5 j. 53% 6
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
