Question 1: Compute the value of each of the following Java expressions and specify the type. Give the values Java would compute.
Type Value
(a) 8.2 – 13 / 3 * 2.5 ___________ _________
(b) 7 * 3 / 8 ___________ _________
(c) 30 / (8 * 1.5) ___________ _________
(d) 11 - 10 / 4 + 2 ___________ _________
(e) 6 / 5 * 3.5 - 2 ___________ _________
(f) 30 / 8 * 1.5 ___________ _________
(g) 2 % 2 + 2 * 2 ___________ _________
(h) 7.5 + 3 * 6 / 4 ___________ _________
(i) (3 * 3 * (3 + (9 / 4))) ___________ _________
(j) 4 * 5 + 13 / 10.0 ___________ _________
Question 2: Write the Java statements for the following descriptions.
(a) Declare a variable called count of type int.
_____________________________________________________________________
(b) Declare a variable called distance of type double.
_____________________________________________________________________
(c) Declare a variable called found of type boolean.
_____________________________________________________________________
(d) Declare a variable called middle of type char.
_____________________________________________________________________
(e)
Declare quot1,
a variable of type double, and
set it equal to the equation:
. (You may assume the
variables k, A, x,
y, r, and z
have already been declared as doubles.)
______________________________________________________________________________________________________
(f)
Declare quot3,
a variable of type double, and
set it equal to the equation:
. (You may assume the
variables k, A, x,
y, r, and z
have already been declared as doubles.)
______________________________________________________________________________________________________
(g)
Declare quot4,
a variable of type double, and
set it equal to the equation:
. (You may assume the
variables k, A, x,
y, r, and z
have already been declared as doubles.)
______________________________________________________________________________________________________
(h)
Declare quot5,
a variable of type double, and
set it equal to the equation:
. (You may assume the
variables k, A, x,
y, r, and z
have already been declared as doubles.)
______________________________________________________________________________________________________
(i)
Declare quot6,
a variable of type double, and
set it equal to the equation:
. (You may assume the
variables k, A, x,
y, r, and z
have already been declared as doubles.)
______________________________________________________________________________________________________