Instructions:Omitted
Getting Ready:Omitted
SectionComparator
class.
SectionComparator
class.
I replaced bMin = oMin
with bMin == oMin
and I initialized oMin
to
Statistics.min(otherGrades)
.
SectionComparatorDriver
class.
SectionComparatorDriver
.
Test case A should have returned a 1,
test case B should have returned a -1 and test case C
should have returned a 1.
bMean
and oMean
are initialized
incorrectly. Fix these faults.
Initialized
Initialized bMean
to
Statistics.mean(bernsteinGrades)
oMean
to
Statistics.mean(otherGrades)
SectionComparatorDriver
.
Same as above.
result
is initialized
incorrectly. Fix this fault.
Initialized result
to 1 (which
is the default case given the if
statements
that follow).
SectionComparatorDriver
.
Test case B should have returned a -1.
Statistics
class.
Statistics.min(int[])
method.
Specifically, result
is initialized incorrectly.
Fix this fault by initializing result
to
data[0]
.
Statistics
class and execute the
SectionComparatorDriver
.
None.
One in which the result is 0.
SectionComparatorDriver
:
int[] bD = {50, 60, 70};
int[] oD = {70, 60, 50};
and add code that uses this test case.
SectionComparatorDriver
class.
It should be 0 but it is 1.
Statistics
class or
faults in the SectionComparatorDriver
class.
Statistics.max(int[])
method.
It didn't work correctly when the maximum was the last element
in the array. I changed data.length-1
to
data.length
.
SectionComparatorDriver
class.
No.
SectionComparator
now
appears to work, there is a fault in the
Statistics.mean(int[])
method.
Statistics.mean(int[])
method.
It doesn't work properly when the array has a no elements.
Statistics.mean(int[])
method.
It does not work properly for positive numbers.
Statistics.max(int, int)
method.
It does not work properly when the two values are the same.
Statistics.min(int, int)
method.
It only works properly when the two values are the same.
Statistics.sign(double)
method.
It does not work properly for 0.
Copyright 2010