0% found this document useful (0 votes)
40 views

Create A Application To Save The Employee Information Using Arrays.

Uploaded by

dipanshu19
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)
40 views

Create A Application To Save The Employee Information Using Arrays.

Uploaded by

dipanshu19
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/ 3

Experiment1.

Student Name: Dipanshu Thakur UID: 21BCS3162


Branch: BE-CSE Section/Group:21BCS-CC-643(B)
Semester: 6 Date of Performance:12-01-2024
Subject Name: Java Lab Subject Code:21CSH-319

1. Aim: Create a application to save the employee information using arrays.

2. Objective: 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 details.

3. Script:
import java.util.*;
public class Project1 {
static void EmployeeDetails() {
String Header[] = { "Emp No.", "Emp Name", "Join Date", "DesigC", "Dept", " Basic", " HRA", " IT" };
String Emp1[] = { "1", "Dipanshu", "01/04/2009", "e ", "R&D", "20000", "8000", "3000" };
String Emp2[] = { "2", "Sushma", "23/08/2012", "c ", "PM", "30000", "12000", "9000" };
String Emp3[] = { "3", "Rahul ", "12/11/2008", "k ", "Acct", "10000", "8000", "1000" };
String Emp4[] = { "4", "Chahat", "29/01/2013", "r ", "Front", "12000", "6000", "2000" };
String Emp5[] = { "5", "Ranjan", "16/07/2005", "m ", "Engg", "50000", "20000", "20000" };
String Emp6[] = { "6", "Suman ", "01/01/2000", "e ", "Manuf", "23000", "9000", "4400" };
String Emp7[] = { "7", "Tanmay", "12/06/2006", "c ", "PM", "2900", "12000", "10000" };
String Emp8[] = { "8", "Rahul", "29/01/2007", "c ", "PM", "2900", "8000", "8000" };
String Emp9[] = { "9", "Aditya", "08/09/2009", "r ", "R&D", "4900", "10000", "12000" };
String Emp10[] = { "10", "Aryan", "11/12/2008", "k ", "PM", "3900", "9000", "13000" };

int DA[] = { 20000, 32000, 12000, 15000, 40000 };


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 };

String Department[] = { "Engineer", "Consultant", "Clerk", "Receptionist", "Manager" };


Scanner sc = new Scanner(System.in);
System.out.println("Print details of Employee by employee Number: ");
int Enter = sc.nextInt();

switch (Enter) {
case 1:
for (int i = 0; i < 2; i++) {
System.out.printf(Header[i] + " ");
}
System.out.printf("Department ");
System.out.printf("Salary ");
System.out.println();

for (int i = 0; i < 2; i++) {


System.out.printf(Emp1[i] + " ");
}
System.out.printf(Department[0] + " ");
System.out.print(Basic[0] + HRA[0] + DA[0] - IT[0]);
break;
case 2:
for (int i = 0; i < 2; i++) {
System.out.printf(Header[i] + " ");
}
System.out.printf("Department ");
System.out.printf("Salary ");
System.out.println();

for (int i = 0; i < 2; i++) {


System.out.printf(Emp2[i] + " ");
}
System.out.printf(Department[1] + " ");
System.out.print(Basic[1] + HRA[1] + DA[1] - IT[1]);

break;
case 3…10:
same as above cases.
break;
default:
System.out.println("There is no employee with empid : " + Enter);
}
sc.close();
}
public static void main(String[] args) {
EmployeeDetails();
}
}
4. Output:

You might also like