Page 399 - AP Computer Science A, 7th edition
P. 399

/∗ more code ∗ / }
Which of the following is a correct replacement for /∗ more code ∗/ so that the postcondition for the method is satisfied?
for (int month = 1; month < rainfall.length; month++)
I
II
for (int day = 1; day < rainfall[month].length; day++)
total += rainfall[month][day]; return total / (13 ∗ 32);
for (int month = 1; month < rainfall.length; month++)
for (int day = 1; day < rainfall[month].length; day++)
total += rainfall[month][day]; return total / 365;
for (double[] month : rainfall) for (double rainAmt : month)
III
return total / 365;
total += rainAmt;
(A) None
(B) I only
(C) II only
(D) III only
(E) II and III only
36. This question is based on the Point class below:
public class Point
{
/∗ ∗ The coordinates. ∗ / private int x;
private int y;
public Point (int xValue, int yValue) {
x = xValue;









































































   397   398   399   400   401