adbulrhman saeed almoutiri
unknown
plain_text
3 years ago
2.4 kB
2
Indexable
import java.util.Scanner; public class JavaApplication9 { public static void average(int[][] mat) { int rowTotal = 0,count =0, col; double average = 0; for ( col= 0; col< mat.length; col++){ System.out.println("عمر الموظف رقم "+(col+1)+" تبقي له في الخدمة "+(60-mat[0][col])+" سنة") ; rowTotal += mat[0][col]; ++count; } average=rowTotal /count; System.out.println(" عدد الموظفين في الادارة رقم "+(1)+"مجموع اعمارهم هو "+rowTotal +" متوسط اهمارهم هو "+average) ; rowTotal = 0;average = 0;count =0; for ( col= 0; col< mat.length; col++){ System.out.println("عمر الموظف رقم "+(col+1)+" تبقي له في الخدمة "+(60-mat[1][col])+" سنة") ; rowTotal += mat[1][col]; ++count; } average=rowTotal /count; System.out.println(" عدد الموظفين في الادارة رقم "+(2)+"مجموع اعمارهم هو "+rowTotal +" متوسط اهمارهم هو "+average) ; rowTotal = 0;average = 0;count =0; for ( col= 0; col< mat.length; col++){ System.out.println("عمر الموظف رقم "+(col+1)+" تبقي له في الخدمة "+(60-mat[2][col])+" سنة") ; rowTotal += mat[2][col]; ++count; } average=rowTotal /count; System.out.println(" عدد الموظفين في الادارة رقم "+(3)+"مجموع اعمارهم هو "+rowTotal +" متوسط اعمارهم هو "+average) ; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int i,j,row=3,col=3; int[][] mat = new int[row][col]; try { System.out.println("بيانات موظفي الشركي") ; System.out.println("ادخل اعمار الموظفين") ; for(i=0;i<row;i++) { for(j=0;j<col;j++) { mat[i][j] = sc.nextInt(); } } average ( mat); }catch(Exception e) { System.out.println("Something Error (Please Enter Age Number) "); } } }
Editor is loading...