Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

EXPERIMENT NUMBER- 1

STUDENT’S NAME Sumit Kumar


STUDENT’S UID 19BCS2141
CLASS AND GROUP 19BCS CI-2 A
SEMESTER 6
SUBJECT NAME Project Based Learning In Java Lab
SUBJECT CODE CSP - 358

AIM OF THE EXPERIMENT :

Given the following table in Prj1.pdf 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.

TASKS TO BE DONE/WHICH LOGISTICS USED :

To develop a small java application, which accepts employee id from the command prompt and
displays the employee details as output.

STEPS FOR EXPERIMENT/PRACTICAL/CODE :

import java.util.Scanner;
public class Main {
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);

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

String empName[]={"Ashish","Sushma","Rahul","Chahat","Ranjan","Suman","Tanmay"};

String
joinDate[]={"01/04/2009","23/08/2012","12/11/2008","29/01/2013","16/07/2005","1/1/2000",
"12/06/2006"};

char designation[]={'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};

int da=-1,in=-1;
System.out.println("Name: AMAN SHARMA");
System.out.println("UID: 19BCS2095\n\n");
int v=sc.nextInt();
for(int i=0;i<7;i++)
{
if(empNo[i]==v)
{ in=i;
break;
}
}
if(in==-1)
System.out.println("There is no employee with empid :" + v);
else
{
System.out.println("Emp No. "+" Emp Name "+" Department "+" Designation "+" Salary ");
System.out.print(" "+empNo[in]+" ");
System.out.print(" "+empName[in]+" ");
System.out.print(" "+dept[in]+" ");
switch(designation[in])
{
case 'e':
System.out.print(" Engineer ");
da=20000;
break;
case 'c':
System.out.print(" Consultant ");
da=32000;
break;
case 'k':
System.out.print(" Clerk ");
da=12000;
break;
case 'r':
System.out.print(" Receptionist ");
da=15000;
break;
case 'm':
System.out.print(" Manager ");
da=40000;
break;
default:
break;
}
int val=(basic[in]+hra[in]+da-it[in]);
System.out.print(" "+val+" ");
}
sc.close();
}
}
OBSERVATIONS/DISCUSSIONS/COMPEXITY ANALYSIS :

We draw the line using DDA line drawing algorithm for positive and negative line slope.

RESULT /OUTPUT/SUMMARY:

You might also like