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

Practical - 1 Aim:: PBL Lab (CSP-378)

The document describes a Java program that accepts an employee ID from the command line and displays the employee's details from a table. The program contains two tables - one with employee data like name, department, salary details. The other maps designation codes to designations and DA amounts. Based on the ID input, it looks up the employee from the first table, finds the designation code, maps it to get the DA amount from the second table and calculates the total salary to display the ID, name, department, designation and salary.

Uploaded by

yakuji shenovar
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)
21 views3 pages

Practical - 1 Aim:: PBL Lab (CSP-378)

The document describes a Java program that accepts an employee ID from the command line and displays the employee's details from a table. The program contains two tables - one with employee data like name, department, salary details. The other maps designation codes to designations and DA amounts. Based on the ID input, it looks up the employee from the first table, finds the designation code, maps it to get the DA amount from the second table and calculates the total salary to display the ID, name, department, designation and salary.

Uploaded by

yakuji shenovar
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

PBL Lab (CSP-378) Page |1

PRACTICAL – 1
AIM: Given the following table containing information about employees of an
organisation, develop a small application which accepts employee id from the
command prompt and displays the following details as output:

CODE:
import java.util.*;
public class Abc {
public static void main(String[] args) {
Scanner o=new Scanner(System.in);
String ID;
int temp,sal;
String a[][]={
{"Emp No.","Emp Name","Join Date","Designation Code","Department", "Basic",
"HRA", "IT"},

SHRAY R. GOSWAMI 16BCS2456


PBL Lab (CSP-378) Page |2

{"1001","Ashish","01/04/2009","e","R&D","2000","8000","3000",},
{"1002","Sushma","23/08/2012","c","PM","30000","12000","9000"},
{"1003","Rahul","12/11/2008","k","Acct","10000","8000","1000"},
{"1004","Chahat","29/01/2013","r","Front Desk","12000","6000","2000"},
{"1005","Rajan","16/07/2005","m","Engg","50000","20000","20000"},
{"1006","Suman","1/1/2000","e","Manufacturing","23000","9000","4400"},
{"1007","Tanmay","12/06.2006","c","PM","29000","12000","10000"}
};
String b[][]={
{"Designation Code","Designation","DA"},
{"e","Engineer","20000"},
{"c","Consultant","32000"},
{"k","Clerk","12000"},
{"r","Receptionist","15000"},
{"m","Manager","40000"},
};

System.out.print("Enter ID: ");


ID=o.next();
for(int i=0;i<8;i++)
{
if(ID.equals(a[i][0]))
{
System.out.println("Destination Code: "+a[i][3]);
temp=Integer.parseInt(a[i][5])+Integer.parseInt(a[i][6])-Integer.parseInt(a[i][7]);

switch(a[i][3].charAt(0))
{
case 'e': sal=temp+Integer.parseInt(b[1][2]);
System.out.println(a[i][0]+"\t"+a[i][1]+"\t"+a[i][4]+"\t"+a[i][3]+"\t"+sal);
break;
case 'c': sal=temp+Integer.parseInt(b[2][2]);
System.out.println(a[i][0]+"\t"+a[i][1]+"\t"+a[i][4]+"\t"+a[i][3]+"\t"+sal);
break;
case 'k': sal=temp+Integer.parseInt(b[3][2]);
System.out.println(a[i][0]+"\t"+a[i][1]+"\t"+a[i][4]+"\t"+a[i][3]+"\t"+sal);
break;
case 'r': sal=temp+Integer.parseInt(b[4][2]);
System.out.println(a[i][0]+"\t"+a[i][1]+"\t"+a[i][4]+"\t"+a[i][3]+"\t"+sal);
break;
case 'm': sal=temp+Integer.parseInt(b[5][2]);

System.out.println(a[i][0]+"\t"+a[i][1]+"\t"+a[i][4]+"\t"+a[i][3]+"\t"+sal);

SHRAY R. GOSWAMI 16BCS2456


PBL Lab (CSP-378) Page |3

break;
}
break;
}
}
}

OUTPUT:

SHRAY R. GOSWAMI 16BCS2456

You might also like