Write a method called sumRange that accepts two integer parameters that represent a range. Issue an error message and return zero if the second parameter is less than the first. Otherwise, the method should return the sum of the integers in that range (inclusive).
What will be an ideal response?
```
public int sumRange(int start, int end)
{
int sum = 0;
if (end < start)
System.out.println("ERROR: Invalid Rangeā);
else
for (int num = start; num <= end; num++)
sum += num;
return sum;
}
```
You might also like to view...
Write a for-each loop that prints all elements in a collection of Student objects called role. What is required for that loop to work?
What will be an ideal response?
The ____ enables you to simplify access to the shared folders on a network by setting up folders to appear as though they are accessed from only one place.
A. Encrypted File System B. Distributed File System C. Dispersed File System D. Extended File System
Determine the monthly payment for the loan described below. Use the fixed-rate mortgage monthly payment formula. Round your answer to the nearest cent. Cost of house: $113,150Interest Rate: 5.85%Term: 20 yearsThe monthly payment is $__________.
Fill in the blank(s) with the appropriate word(s).
As shown in the top right of the accompanying figure, ____ softens the edges of a selection.
A. anti-aliasing B. lassoing C. feathering D. vignetting