Linux-Fan

Notenproblem

Jan 24th, 2012
107
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package ma.test;
  2.  
  3. public class NotenproblemMa {
  4.     public static void main(String[] args) {
  5.         float punkteErreicht = 92.0f;
  6.         float punkteMoeglich = 100.0f;
  7.         float in = punkteErreicht / punkteMoeglich;
  8.        
  9.         final float[][] assoc = {
  10.             {0.96f, 15.0f},
  11.             {0.91f, 14.0f},
  12.         };
  13.         float ret = 0.0f;
  14.         for(int i = 0; i < assoc.length; i++) {
  15.             if(assoc[i][0] <= in) {
  16.                 ret = assoc[i][1];
  17.                 break;
  18.             }
  19.         }
  20.         System.out.println(ret);
  21.     }
  22. }
RAW Paste Data