GregBrannon, on 02 October 2011 - 08:31 AM, said:
Here's the method as it should be:
private String getRelationToPar( int score )
{
// calculate the difference between score and par
int difference = par - score;
// initialize a string for the result
String relation = "";
// score and par are the same
if ( difference == 0 )
{
relation += "Same as par";
}
// the score is less than par
else if ( difference > 0 )
{
relation += difference + " under par.";
}
// the score is greater than par
else
{
relation += Math.abs( difference ) + " over par.";
}
return relation;
} // end method getRelationToPar()
Read this method. Ask questions about what you don't understand. Paste it into your GolfScore() method. You tell me what's next.
What is math.abs? And next isn't there one more method and if so can you just give it to me so we can be done and just explain it.Or we have to go call the methods in the client. haha

New Topic/Question
Reply




MultiQuote



|