I have a little problem in my java application.
I have to calculate the score they have when they finish, I use this method:
public Float ScoreProcent(in
Float num = (float) (100 / y * x);
The problem is that you weren't using the float you just built before.
Alternatively I suggest this :
public float getScorePercent(int questions, int correct){
return 100f * correct / questions;
}
It's generally advised to avoid Float
and use float
, except when you really need objects (that is rarely).