Question: 7. (10 points) Write a public static method called sumSubArray that has as its input two integers and a reference to an array of doubles.
7. (10 points) Write a public static method called sumSubArray that has as its input two integers and a reference to an array of doubles. If the two integers are valid indices, then the method should return the sum of the values stored in that part of the array hose indices are between the two integers (inclusive). If the two integers are not valid indices, then the method should return zero. The two integers are valid indices if the first integer is not negative, the second integer is greater than the first integer, and the second integer is less than the length of the array
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
