If you happened to need a rounding code in java, which works good and well
here is the examples of the function
public static int[] roundingModulusFunction(int[]grades)
{
int[] result = new int[grades.length];
for (int i=0; i<grades.length; i++)
{
int grade = grades[i];
if(grade<25)
{
result[i] = grade;
}
else
{
int modulus = grade%5;
if (modulus > 2) {
result[i] = grade + (5-modulus);
} else
{
result[i] = grade;
}
}
}
return result;
}
0 komentar :
Posting Komentar
Mari berkomentar dengan baik, benar, dan sopan :D