محمد احمد المالكي
unknown
plain_text
3 years ago
2.6 kB
7
Indexable
/*
* 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 javaapplication3;
import javax.swing.JOptionPane;
import jdk.nashorn.internal.parser.TokenType;
/**
*
* @author CTI
*/
public class JavaApplication3 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int d=Integer.parseInt(JOptionPane.showInputDialog("ادخل رقم الداره"));
int x=Integer.parseInt(JOptionPane.showInputDialog("عدد الموظفين"));
double avg=0.0;
int r,sum=0;
if (d==1)
{
for(int i=0;i<x;i++)
{
r=Integer.parseInt(JOptionPane.showInputDialog("عدد عمر الموظف"));
if (r>=60||r<=0) JOptionPane.showMessageDialog(null,"العمر غير صحيح");
sum=+r;
avg=sum/x;
}
JOptionPane.showMessageDialog(null,"عدد الموظفين الاره رقم 1:\n"+x+" مجموع اعمرهم هو\n"+sum+"متوسط اعمترهم هو\n"+avg);
}
else if(d==2)
{
for(int i=0;i<x;i++)
{
r=Integer.parseInt(JOptionPane.showInputDialog("عدد عمر الموظف"));
if (r>=60||r<=0) JOptionPane.showMessageDialog(null,"العمر غير صحيح");
sum=+r;
avg=sum/x;
}
JOptionPane.showMessageDialog(null,"عدد الموظفين الاره رقم 1:"+x+" مجموع اعمرهم هو :"+sum+" \nمتوسط اعمترهم هو :"+avg);
}
else if(d==3)
{
for(int i=0;i<x;i++)
{
r=Integer.parseInt(JOptionPane.showInputDialog("عدد عمر الموظف"));
if (r>=60||r<=0) JOptionPane.showMessageDialog(null,"العمر غير صحيح");
sum=+r;
avg=sum/x;
}
JOptionPane.showMessageDialog(null,"عدد الموظفين الاره رقم 2:"+x+" مجموع اعمرهم هو\n"+sum+"متوسط اعمترهم هو"+avg);
}
else
JOptionPane.showMessageDialog(null,"رقم الداره غير صحيح");
}
}
Editor is loading...