# Answer to Question #7695 in Java | JSP | JSF for emily

Question #7695

1) write a method called larger that accepts two floating point parameters (of type double) and returns true if the first parameter is greater than the second, and false otherwise.

2)write a method called sumRange that accepts two integer parameters representing 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 the range, inclusive.

2)write a method called sumRange that accepts two integer parameters representing 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 the range, inclusive.

Expert's answer

public class Question {

public static boolean Lager(double a, double b){

return a>b;

}

public static int sumRange(int a, int b){

int sum = 0;

if(a>b)

return 0;

for(int i=a; i<=b; i++)

sum+=i;

return sum;

}

}

public static boolean Lager(double a, double b){

return a>b;

}

public static int sumRange(int a, int b){

int sum = 0;

if(a>b)

return 0;

for(int i=a; i<=b; i++)

sum+=i;

return sum;

}

}

## Comments

## Leave a comment