How to do a grading system with pre-given list of integers in java? -


i convert list of marks given grade.

public static void main (string[] arg){     int[] m= student.getmarks();  }  public static char grade (int[] m){   int[] lowestg = {80,70};   char[] g = new char[m.length];   (int x=0; x<m.length; x++){     n=0;             (int y=0; y<m.length; y++){        if (m[x]>=lowestg[0]){         g[y] = 'h';        }        else if (m[x]>=lowestg[1]){         g[y] = 'd';        }        else          g[y] = 'f';     }   return g;   }  } 

i put array of characters.

when tried build it, shwoing

error: incompatible types

your code unclear. guess want.

public static char[] grade(int[] m) {     char[] g = new char[m.length];     (int = 0; < m.length; i++) {         if (m[i] >= 80)             g[i] = 'h';         else if (m[i] >= 70)             g[i] = 'd';         else             g[i] = 'f';     }     return g; } 

it's public static char[] grade(int[] m) not public static char grade(int[] m) in code.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -