Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
84 views2 pages

PBLJ Lab Worksheet 1.1

The document describes a Java program that accepts an employee ID from the command line and displays employee details from arrays like name, department, designation, and calculated salary. The program contains employee data in arrays, searches the ID in the employee number array, and if found prints the details from the corresponding indexes of other arrays.

Uploaded by

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

PBLJ Lab Worksheet 1.1

The document describes a Java program that accepts an employee ID from the command line and displays employee details from arrays like name, department, designation, and calculated salary. The program contains employee data in arrays, searches the ID in the employee number array, and if found prints the details from the corresponding indexes of other arrays.

Uploaded by

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

Worksheet 1.

Name: Milan Kamboj UID: 18BCS6701


Branch: BE – CSE Section/Group: 18_IS_10 G1
{{{ {{{
Semester: 6 th
Date of Performance: 2nd Feb 2021
Subject Name: PBLJ Lab Subject Code: CSP-358

Aim: Given the following table containing information about employees of an organization,
develop a small java application, which accepts employee id from the command prompt and
displays the following details as output.

Code (Java):
package pkg;
import java.util.*;

public class cls {


public static void main(String[] args)
{
Scanner sc= new Scanner(System.in);

int[] emp_no = {1001, 1002, 1003, 1004, 1005, 1006, 1007};


String[] emp_name = {"Ashish", "Sushma", "Rahul", "Chahat", "Ranjan",
"Suman"};
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[] des_code = {"e","c","k","r","m","e","c"};
String[] department = {"R&D","PM","Acct","Front\r\n" +
"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};
int SALARY,temp=-1;
String[] designation =
{"Engineer","Consultant","Clerk","Receptionist","Manager"};
int[] DA = {20000,32000,12000,15000,40000};

System.out.print("Enter the employee code: ");


int info= sc.nextInt();
for(int i=0;i<emp_no.length;i++)
{
if(info == emp_no[i])
{
temp = i;
}
}

if(temp>=0)
{
System.out.print("employee code: "+emp_no[temp]+"\n");
18BCS6701 18_IS_10 G1
System.out.print("employee Name: "+emp_name[temp]+"\n");
System.out.print("employee Department: "+department[temp]+"\n");
System.out.print("employee Designation: "+designation[temp]+"\n");
SALARY = basic[temp]+HRA[temp]+DA[temp]-IT[temp];
System.out.print("employee SALARY: RS "+SALARY);

}
else

{
System.out.println("Employee Does Not Exist!");
}
}
}

Output (Snapshot):

18BCS6701 18_IS_10 G1

You might also like