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;
}
```

Computer Science & Information Technology

You might also like to view...

____ refers to a set of wireless networking technologies that transmits data using radio waves.

A. Ethernet B. Wi-Fi C. Wii D. broadband

Computer Science & Information Technology

Why do command names and filenames usually not have embedded SPACEs? How would you create a filename containing a SPACE? How would you remove it? (This is a thought exercise, not recommended practice. If you want to experiment, create a file and work in a directory that contains only your experimental file.)

What will be an ideal response?

Computer Science & Information Technology

At the top of the home page is a(n) ________ that you use to navigate around the Pinterest site

Fill in the blank(s) with correct word

Computer Science & Information Technology

A hierarchy of text indicates the level of importance among the entered text on a slide

Indicate whether the statement is true or false

Computer Science & Information Technology