فهد صالح العنزي

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.5 kB
1
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 javaapplication2;

import javax.swing.JOptionPane;

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

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        int size=10;
        String empolyees [] = new String[size];
        int score[] = new int[size];
     
        for (int i = 0; i < size; i++) {
            empolyees [i]=JOptionPane.showInputDialog("Enter empolyees Name :");
            score[i]=Integer.parseInt(JOptionPane.showInputDialog("Enter age :"));
        }
        int aboveAvgCount = 0;
        
        double total = 0;
        double avgS = 0;

        for (int i = 0; i < size; i++) 
            total =total+ score[i];
        
        avgS = total / score.length;

        for (int i = 0; i < size; i++) {
            if (score[i] > avgS) 
                aboveAvgCount++;
            

            if (score[i] < avgS) 
                System.out.println(empolyees[i]+" is Below Average");           
        }
        System.out.println("The Average Score Is:\t" + avgS);
        System.out.println("Number of empolyees's Score more than Average:\t"+aboveAvgCount);
    }

}