ibrahim alqarni

mail@pastecode.io avatar
unknown
plain_text
2 years ago
2.0 kB
3
Indexable
Never
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package javaapplication;

import javax.swing.JOptionPane;

/**
 *
 * @author CTI
 */
public class JavaApplication {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // ابراهيم علي موسى القرني
        int sum=0,sum1=0,yearOFex=60,avg;
        String info ="",infoAll="";
        int [][] emp = new int [3][];
            for (int i=0;i<emp.length;i++)
            {
                int y = Integer.parseInt(JOptionPane.showInputDialog("ادخل عدد الموظفين في الادارة رقم "+(i+1)));
                emp[i] = new int [y];
                sum+= y;
                    for (int j=0;j<y;j++)
                    {
                        int ex = Integer.parseInt(JOptionPane.showInputDialog(" ادخل عدد سنوات الخبرة للموظف رقم"+(j+1)));
                        if (ex>59 || ex<1) {JOptionPane.showMessageDialog(null,"يجب ان لاتقل الخبره عن سنة واحد ولاتزيد عن ستون سنة");System.exit(0);}
                           emp[i][j] = Integer.parseInt(JOptionPane.showInputDialog("ادخل عمر الموظف رقم "+(j+1)));
                           sum1+=emp[i][j];
                           yearOFex -= emp[i][j];    
                           info+="age of employee No "+(j+1)+" age is : "+emp[i][j]+" the total of year left "+yearOFex+"\n";
                    }
                    avg=sum1/y;
                     infoAll="numbers of employees in department "+(i+1)+" : "+sum+"total of ages is :"+sum1;
                     JOptionPane.showMessageDialog(null,"List of employees \n"+info+"\n"+infoAll+" The Avarege Of ages is :"+avg);
    }
    
}
}