/*
* 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.JOptionPane;
/**
*
* @author CTI
*/
public class JavaApplication8 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int num;
char c='1';
while(c=='1'){
num=Integer.parseInt(JOptionPane.showInputDialog(null,""));
switch(num){
case 1:{
int num1,num2;
String nums="";
do{
num1=Integer.parseInt(JOptionPane.showInputDialog(null," Enter the First Number"));
}while(num1 <=0);
do{
num2=Integer.parseInt(JOptionPane.showInputDialog(null," Enter the Second Number"));
if(num2<num1 && num2>0)
{
JOptionPane.showMessageDialog(null,"the Second Number "+num2+ " > "+num1 );
}
else if( num2<= 0){
JOptionPane.showMessageDialog(null,"the Second Number "+num2+ " < Zero" );
}
}while( num2 <num1);
for(int x=num1; x<=num2; x++ ){
if(x%2!=0){
nums+= x+" ";
}
}
JOptionPane.showMessageDialog(null,"the numbers between "+num1 + " and "+num2 +" is : " + nums);
int n=JOptionPane.showConfirmDialog(null, "",JOptionPane.YES_NO_OPTION);
JOptionPane.showMessageDialog(null,"the area of traingle "+n);
break; }
case 2:{
int num1,num2;
String nums="";
do{
num1=Integer.parseInt(JOptionPane.showInputDialog(null," Enter the base"));
}while(num1 <=0);
do{
num2=Integer.parseInt(JOptionPane.showInputDialog(null," Enter the height"));
/*if(num2<num1 && num2>0)
{
JOptionPane.showMessageDialog(null,"the Second Number "+num2+ " > "+num1 );
}
else if( num2<= 0){
JOptionPane.showMessageDialog(null,"the Second Number "+num2+ " < Zero" );
}*/
}while( num2 <=0);
double sum;
sum =0.5 * num1*num2;
JOptionPane.showMessageDialog(null,"the area of traingle "+sum);
break; }
case 3:{
int numsOfEmp=Integer.parseInt(JOptionPane.showInputDialog(null," Enter the numbers of emplyees"));
double sum=0.0,avg=0.0;
String names[]=new String[numsOfEmp];
double sal[]=new double[numsOfEmp];
for(int i=0; i<names.length; i++){
names[i]=JOptionPane.showInputDialog(null," Enter the name "+ (i+1));
sal[i]=Integer.parseInt(JOptionPane.showInputDialog(null," Enter the Salary For " + names[i]));
sum +=sal[i];
}
avg=sum/numsOfEmp;
JOptionPane.showMessageDialog(null,"the Total of salaries "+sum+ " \n The avarage is "+ avg);
}
}
}
}
}