Hi,

I am working one below challenge

http://codingbat.com/prob/p137742
public boolean love6(int a, int b) {

if((a==6||b==6)|(a+b==6)|(a-b==6))

{

return true;

}

else{

return false;

}

}

i am failing one test case

Expected Run

love6(6, 4) → true true OK

love6(4, 5) → false false OK

love6(1, 5) → true true OK

love6(1, 6) → true true OK

love6(1, 8) → false false OK

love6(1, 7) → true false X

love6(7, 5) → false false OK

love6(8, 2) → true true OK

love6(6, 6) → true true OK

love6(-6, 2) → false false OK

love6(-4, -10) → true true OK

love6(-7, 1) → false false OK

love6(7, -1) → true true OK

love6(-6, 12) → true true OK

love6(-2, -4) → false false OK

love6(7, 1) → true true OK

love6(0, 9) → false false OK

love6(8, 3) → false false OK

love6(3, 3) → true true OK

love6(3, 4) → false false OK

other tests

OK

how do i design this problem with flow chart etc and how to improve my design and implementation. please advise

Open in new window

The question gave you a clue about using Math.abs(..)

Secondly, instead of using bitwise-OR you need to use ||