Consider the following instance variables and method that appear in a class representing student information.
private int assignmentsCompleted;
private double testAverage;
public boolean isPassing()
{ /* implementation not shown */ }
A student can pass a programming course if at least one of the following conditions is met.
- The student has a test average that is greater than or equal to 90.
- The student has a test average that is greater than or equal to 75 and has at least 4 completed assignments.
Consider the following proposed implementations of the isPassing
method.
I)
if (testAverage >= 90)
return true;
if (testAverage >= 75 && assignmentsCompleted >= 4)
return true;
return false;
II)
boolean pass = false;
if (testAverage >= 90)
pass = true;
if (testAverage >= 75 && assignmentsCompleted >= 4)
pass = true;
return pass;
III)
return (testAverage >= 90) ||
(testAverage >= 75 && assignmentsCompleted >= 4);
Which of the implementations will correctly implement method isPassing?
A) I only
B) II only
C) I and III only
D) II and III only
E) I, II, and III