Hello everyone! I was working on a problem that I thought would be quite simple, but for some reason, my code won't return any percentage other than 0. I am supposed to return the percentage of grades that are less than 60 from an array of grades. This is what I came up with:
public class FunctionalityTest { public float getPercentFailing(float[] grades) { int failed = 0; for (int i = 0; i < grades.length; i++) { if (grades[i] < 60f) { failed += 1; } } return failed / grades.length; } }
Any help or advice would be very much appreciated!