Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ArrayProcedure
- {
- private int [][] A;
- int seires,stiles;
- public void create (int SEIRES, int STILES)
- {
- seires=SEIRES;stiles=STILES;
- A = new int [SEIRES][STILES];
- for(int i=0;i<SEIRES;i++)
- for(int y=0;y<STILES;y++)
- A[i][y] = (int) (Math.random() * 100 + 20);
- }
- public double pososto()
- {
- int sum=0,counter=0;
- for(int i=0;i<seires;i++)
- for(int y=0;y<stiles;y++)
- sum+=A[i][y];
- for(int i=0;i<seires;i++)
- for(int y=0;y<stiles;y++)
- if((A[i][y])<(sum/(seires*stiles)))
- counter++;
- return ((double) counter/(seires*stiles)*100);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement