Introduction of Array

Create an application to save the employee information using arrays (Chandigarh University) -JAVA PROGRAMMING


Create an application to save the employee information using arrays having following fields:- empid[],depName[],empDes,empName[],dateJoin[],basic[],hra[],it[], DesCodes[]. 

Create an application to save the employee information using arrays (Chandigarh University) -JAVA PROGRAMMING


Tasks:-

(a) Salary should be calculated as (Basic+HRA+DA-IT)      

(b)Printing designation and da according to employee designation.


Create an application to save the employee information using arrays (Chandigarh University) -JAVA PROGRAMMING

Description :

Create an application to save the employee information using arrays (Chandigarh University) -JAVA PROGRAMMING
Create an application to save the employee information using arrays (Chandigarh University) -JAVA PROGRAMMING
Create an application to save the employee information using arrays (Chandigarh University) -JAVA PROGRAMMING
Create an application to save the employee information using arrays (Chandigarh University) -JAVA PROGRAMMING

Create an application to save the employee information using arrays (Chandigarh University) -JAVA PROGRAMMING

Create an application to save the employee information using arrays (Chandigarh University) -JAVA PROGRAMMINGCreate an application to save the employee information using arrays (Chandigarh University) -JAVA PROGRAMMING


Program Code:



import java.util.Scanner;
import java.util.Arrays;

public class EmpArray 
{
    public static void main(String[] args)
    {
        int i,index ,da,salary;
        index=-1;
        da=0;
        char empDes; 
        String desg = null;
        int empid[]={1001,1002,1003,1004,1005,1006,1007};
        int basic[]={20000,30000,10000,12000,50000,23000,29000};
        int hra[]={8000,12000,8000,6000,20000,9000,12000};
        int it[]={3000,9000,1000,2000,20000,4400,10000};
        char DesCodes[]={'e','c','k','r','m','e','c'};
        String depName[]={"R&D","PM","Acct","Front Desk","Engg","Manufacturing","PM"};
        String empName[]={"Ashish","Sushma","Rahul","Chahat","Ranjan","Suman","Tanmay"};
        String dateJoin[]={"1/04/2009","23/08/2012","12/11/2008","29/01/2013","16/07/2005","1/01/2000","12/06/2006"};
        
       
Scanner s = new Scanner(System.in);
System.out.println("Enter Employee id:");
int number = s.nextInt();


for(i=0;i<7;i++)
{
    if(number==empid[i])
     {
        index=i;
     }
}
    if(index==-1)
     {
        System.out.print("Invalid Employee id is");
        System.out.println(number);
        return;
     }
empDes=DesCodes[index];
if(empDes=='e')
{
    desg="Engineer";
    da=20000;
}
else if(empDes=='c')
{
    desg="Consultants";
    da=32000;
}
else if(empDes=='k')
{  
    desg="Clerk";
    da=12000;
}
else if(empDes=='r')
    desg="Receptionist";
    da=15000;
}
else if(empDes=='m')
{
    desg="Manager";
    da=40000;
}
salary=basic[index]+hra[index]+da-it[index];

System.out.println("Emp no\t\tEmployee Name\t\tDeaprtment\t\tDesignation\t\tSalary");
System.out.println(empid[index]+"\t\t\t"+empName[index]+"\t\t\t"+depName[index]+"\t\t\t"+desg+"\t\t"+salary);
}
}


Create an application to save the employee information using arrays (Chandigarh University) -JAVA PROGRAMMING