Question: Add tests to the tests.TestProblemSet class that will test a static method named average in the ratings.ProblemSet class The average method will take an ArrayList

Add tests to the tests.TestProblemSet class that will test a static method named average in the ratings.ProblemSet class
The average method will take an ArrayList of Doubles as a parameter and returns the average of the values in the ArrayList as a double
If the ArrayList is empty, the method should return 0.0
Examples:
average([1.0,2.0,3.0]) returns 2.0
average([-5.0,5.0]) returns 0.0
average([6.5,6.5,8.5,8.5]) returns 7.5
average([]) returns 0.0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!