Advertisement
vnevermore

Askhsh 5

Feb 3rd, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1. public class ArrayProcedure
  2. {
  3.     private int [][] A;
  4.     int seires,stiles;
  5.    
  6.     public void create (int SEIRES, int STILES)
  7.     {
  8.         seires=SEIRES;stiles=STILES;
  9.         A = new int [SEIRES][STILES];
  10.         for(int i=0;i<SEIRES;i++)
  11.             for(int y=0;y<STILES;y++)
  12.                 A[i][y] = (int) (Math.random() * 100 + 20);
  13.     }
  14.  
  15.     public double pososto()
  16.     {
  17.         int sum=0,counter=0;
  18.         for(int i=0;i<seires;i++)
  19.             for(int y=0;y<stiles;y++)
  20.                 sum+=A[i][y];
  21.  
  22.         for(int i=0;i<seires;i++)
  23.             for(int y=0;y<stiles;y++)
  24.                 if((A[i][y])<(sum/(seires*stiles)))
  25.                     counter++;
  26.         return ((double) counter/(seires*stiles)*100);
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement