0

Hi, I have a program that finds out if people are "compatible". The problem I have is that Java seems to be blatantly telling me that 130-130 is greater than 25

public boolean checkMatch(Female other){
if (this.getA()<26&&other.getA()-this.getA()>1){
return false;
}else if(this.getH()-other.getH()>25||this.getH()-other.getH()<-25){
return false;
}else if(this.getP().equals(other.getP())&&this.getS().equals(other.getS())&&this.getD().equals(other.getD())){
return true;
}else{
return false;
}
}

Its supposed to return false if the heights (H) are greater than 25 in difference. But if I enter the heights to be 130 and 130 respectively for example, that part of the method will still return false. I am sure that its the height that's setting it off as I tested it with a method that just checks the "height compatibility". What's going on here?

Thanks.

1
Contributor
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Moonrise_state
0

I got it working. It was a problem with the way my vectors were storing data.
Thanks.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.