0% found this document useful (0 votes)
33 views3 pages

CSE Java

The document describes an experiment that creates an application to save employee information like ID number, name, department, designation, salary details in arrays. The application takes user input for an employee ID and searches the arrays to find the matching employee and print their details including designation and calculated salary. If the ID is not found, a message is displayed indicating the same.

Uploaded by

Aman sehgal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views3 pages

CSE Java

The document describes an experiment that creates an application to save employee information like ID number, name, department, designation, salary details in arrays. The application takes user input for an employee ID and searches the arrays to find the matching employee and print their details including designation and calculated salary. If the ID is not found, a message is displayed indicating the same.

Uploaded by

Aman sehgal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

EXPERIMENT NO 1

NAME – PARAS GUPTA

UID – 20BCS5172

SECTION – 612 A

SUBJECT – PBLJ LAB

DATE – 23-08-2022

QUES -create an application to save the employee information in array.


Code –
import java.util.*;

public class QUES1


{
public static void main(String[] args) {
int emp_no[]= {1001,1002,1003,1004,1005,1006,1007};
String emp_name[]=
{"ASHISH","SUSHMA","RAHUL","CHAHAT","RANJAN","SUMAN","TANMAY"};
String join_date[]={"01/04/2009","23/08/2012 ","12/11/2008
","29/01/2013","16/07/2005","1/1/2000 ","12/06/2006"};
String design_code[]={"E","C","K","R","M","E","C"};
String dept[]={"R&D","PM","ACCT","FRONT
DESK","ENGG","MANUFACTURING","PM"};
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};

Scanner sc = new Scanner(System.in);


System.out.println("enter the emp id - ");
int DA;
int salary;
String designation;
int n = sc.nextInt();
int flag = 0;

for(int i =0;i<7;i++)
{
if(emp_no[i]==n)
{

flag =1;

switch(design_code[i]){

case "E":
DA = 20000;
designation="Engineer";
salary = basic[i]+HRA[i]+ DA-IT[i];
System.out.println("EMP NO EMP NAME DEPARTMENT
DESIGNATION SALARY ");
System.out.println(emp_no[i]+" "+emp_name[i]+"
"+dept[i]+" "+designation+" "+salary);
break;

case "C":
DA = 32000;
designation="consultant";
salary = basic[i]+HRA[i]+ DA-IT[i];
System.out.println("EMP NO EMP NAME DEPARTMENT
DESIGNATION SALARY ");
System.out.println(emp_no[i]+" "+emp_name[i]+"
"+dept[i]+" "+designation+" "+salary);
break;

case "K":
DA = 12000;
designation="clerk";
salary = basic[i]+HRA[i]+ DA-IT[i];
System.out.println("EMP NO EMP NAME DEPARTMENT
DESIGNATION SALARY ");
System.out.println(emp_no[i]+" "+emp_name[i]+"
"+dept[i]+" "+designation+" "+salary);
break;

case "R":
DA = 15000;
designation="receptionist";
salary = basic[i]+HRA[i]+ DA-IT[i];
System.out.println("EMP NO EMP NAME DEPARTMENT
DESIGNATION SALARY ");
System.out.println(emp_no[i]+" "+emp_name[i]+"
"+dept[i]+" "+designation+" "+salary);
break;

case "M":
DA = 40000;
designation="Manager";
salary = basic[i]+HRA[i]+ DA-IT[i];
System.out.println("EMP NO EMP NAME DEPARTMENT
DESIGNATION SALARY ");
System.out.println(emp_no[i]+" "+emp_name[i]+"
"+dept[i]+" "+designation+" "+salary);
break;

if(flag==0)
{
System.out.println("emp id "+n+" doesnot exist ");
}
}
}

Output –

You might also like