Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please write the full answer and give a clear explanation. 10.Imagine you want t

ID: 3719242 • Letter: P

Question

Please write the full answer and give a clear explanation.

10.Imagine you want to test the method boolean reachedTemp (int threshold, char unit) that is supposed to return true if an object's temperature is above a given threshold, measured in a given unit. The threshold should be an integer between 0 and 100 (incl. those values), and the unit should be one of the characters C, F or K. Show how you partition the possible input range into appropriate equivalence classes, and list all test cases you need to expose the method to. (12%)

Explanation / Answer

public class Driver {

public boolean reachedTemp(int threshold, char unit) {

if(threshold >= 0 && threshold <= 100) {

if(unit == 'C' || unit == 'F' || unit == 'K')

return true;

else

return false;

}

else

return true;

}

public static void main(String[] args){

Driver dir = new Driver();

System.out.println(dir.reachedTemp(50, 'C'));

System.out.println(dir.reachedTemp(50, 'A'));

}

}

**Comment for any further queries.