I have a boolean method that is supposed to be able to tell if a score is greater than or equal to 2.5. Here is the code I am having troubles because whenever I test it my computer freaks out a little, so I obvious coded something incorrectly. I think it might have to do with the method it uses which is supposed to set the score and change the image accordingly. This method uses this other method which is supposed to return the score. These are all in my actor class, Sentiment. Any help would be appreciated.
public boolean isPostive()
{
if (getSentimentScore() >= 2.5)
{
return true;
}
else
{
return false;
}
}public void setSentimentScore(double score)
{
this.review = score;
if (getSentimentScore() <= .4)
{
setImage("0.png");
}
else if (getSentimentScore() <= 1.4)
{
setImage("1.png");
}
else if (getSentimentScore() <= 2.4)
{
setImage("2.png");
}
else if (getSentimentScore() <= 3.4)
{
setImage("3.png");
}
else
{
setImage("4.png");
}
}private double review = 0;
public Sentiment()
{
setImage("2.png");
}
public double getSentimentScore()
{
return review;
}
