Abdulrhman Alattas

mail@pastecode.io avatar
unknown
plain_text
2 years ago
2.0 kB
0
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 javaapplication8;
import javax.swing.*;
/**
 *
 * @author CTI
 */
public class JavaApplication8 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        String w="بيانات موظفي الشركة";
        // TODO code application logic here
        double age[][]=new double[3][3];
        double sum=0,sumAll=0,avg=0;
        int c=0,d=0;
        String info="",info2="";
        for(int i=0;i<age.length; i++){
            c=age[i].length;
            info2="";
          d=0;
          avg=0;
          sumAll=0;
            for(int j=0;j<age[i].length;j++){
               do{ try{
                     
                      age[i][j]=Double.parseDouble(JOptionPane.showInputDialog(  "الادار رقم "+(i+1) +"\n"+ "ادخل عمر الموظف رقم"+(j+1)));
                
                }
                catch(Exception e){
                    JOptionPane.showMessageDialog(null, e);
                }
               }while(age[i][j]<18|age[i][j]>59);
                System.out.print(age[i][j] + " , ");
                sum=60-age[i][j];
                sumAll+=age[i][j];
                d++;
              info+="عمر الموظف رقم "+(j+1)+" => "+age[i][j]+" تبقى له في الخدمة"+ sum+"\n";
             
            }
            avg=sumAll/c;
            info2+="عدد موظفين الادارة رقم"+(i+1)+" هو "+c+" مجموع اعمارهم هو"+sumAll+"  متوسط أعمارهم هو"+avg+"\n";
             if(d==3){
                  info+=info2+"\n";
              }
       System.out.println("");
       //  JOptionPane.showMessageDialog(null,w +"\n\n"+info+info2);
        
        }
        
       JOptionPane.showMessageDialog(null,w +"\n\n"+info);
    }
    
}