Java Reference
In-Depth Information
Suppose that you have the following conditional expression. (Assume that
all the variables are properly declared.)
(0 < backyard && backyard <= 5000) ? fertilizingCharges = 40.00
: fertilizingCharges = 40.00 + (backyard - 5000) * 0.01;
a.
What is the value of
fertilizingCharges
if the value of
backyard
is
3000?
b.
What is the value of
fertilizingCharges
if the value of
backyard
is
5000?
c.
What is the value of
fertilizingCharges
if the value of
backyard
is
6500?
18.
4
State whether the following are valid
switch
statements. If not, explain
why. Assume that
n
and
digit
are
int
variables.
19.
switch
(n <= 2)
{
case
0:
System.out.println("Draw.");
break
;
a.
case
1:
System.out.println("Win.");
break
;
case
2:
System.out.println("Lose.");
break
;
}
switch
(digit / 4)
{
case
0:
case
1:
System.out.println("low.");
break
;
b.
case
1:
case
2:
System.out.println("middle.");
break
;
case
3:
System.out.println("high.");
}
switch
(n % 6)
{
case
1:
case
2:
c.
Search WWH ::
Custom Search