tags:

views:

38

answers:

1

Hi everybody,

I just tried to calculate something. All my input is int.

int aveScore = (startScore/((([p1.arrayThrow count]-1)) + winPane.throws));  

The result is (for startscore = 501 and the rest = 3 [501/3 = 167]) 100. Even tried float aveScore which results in something like 10359. Also didn't work:

int aveScore = (float) ...  

What is wrong here?

A: 

int aveScore = (int)((float)startScore / (([p1.arrayThrow count] - 1) + winPane.throws));

EDIT:

If you want a floating point average score then it would just be:

float aveScore = (float)startScore / (([p1.arrayThrow count] - 1) + winPane.throws);

Paul R
The result is the same: 100. But nevertheless, I've forgotten to tell, that I want the result as a float. Should be like `float aveScore = (float) ...` but working :/
lueda