# Coding Bat – icyHot

This exercise requires that the program return the value of true if one of two temperatures entered is less than 0 and the other is greater than 100.

public boolean icyHot(int temp1, int temp2) {

}

As you can see, we have two integer variables named “temp1” and “temp2”.

public boolean icyHot(int temp1, int temp2) {
return ((temp1 < 0 && temp2 > 100) || (temp1 > 100 && temp2 < 0));
}

In the solution, we return a boolean for “temp1” is less than 0 AND “temp2” greater than 100 OR “temp1” is greater than 100 AND “temp2” is less than 0.

Let’s look at the following test data:

• temp1 = -5
• temp2 = 105

On the return, we have (TRUE && TRUE) OR (FALSE && FALSE). This will return as TRUE.

Let’s now look at another set of test data:

• temp1 = 5
• temp2 = 105

On the return, we have (FALSE && TRUE) OR (FALSE && FALSE). This will return as FALSE.

Finally, let’s look the this final set of test data:

• temp1 = 5
• temp2 = 95

On the return, we have (FALSE && FALSE) OR (FALSE && FALSE). This will return as FALSE.

## One thought on “Coding Bat – icyHot”

1. Anonymous says:

👍