Friday, 15 April 2011

java - How to take two-dimensional array of ints and return two-dimensional array of chars? -


I am hoping to read in int value and can create a new array with the equivalent values ​​of each int value. Can someone tell me in the right direction / or can I recommend something to read / read?

I am trying to understand how to write it. Here is what I have so far.

  int [] [] grade = {{90, 54, 32, 25}, {65, 80, 72, 26}}; For (int i = 0; i & lt; grade length; i ++) {for (int j = 0; j & lt; grade [i]. Length; j ++) {if (grade [i] [J]> = 90) if (grade [i] [j]> = 60) {} if (grade [i] [j]> = 80) {} if (grade [i] [j] > Gt = 70) {}} Else {} System.out.print (grade [i] [ja] + "\ t"); }}}}}  

A two-dimensional char Announce and save four of the same category.

  int [] [] grade = {{90, 54, 32, 25}, {65, 80, 72, 26}}; Four [] [] results = new four [grade. Length] [4]; For (int i = 0; i & lt; grade length; i ++) {for (int j = 0; j & lt; grade [i]. Length; j ++) {if (grade [i] [J]> = 90) {Results [i] [j] = 'A'; } ....}}  

No comments:

Post a Comment