I'm trying to construct a method to answer the below question. However I'm having a bit of trouble. Can someone assist me with this logic?
Write a static method odd() that takes three boolean inputs and returns true if an odd number of inputs are true, and false otherwise.
public boolean odd(boolean a, boolean b, boolean c)
{
if((a && b) && (b && c) && (a && c))
return true;
if((a && b) && (b && c) || (a && b) && (a && c))
return false;
return false;
}
Aucun commentaire:
Enregistrer un commentaire