DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
Experiment 1.1
Student Name: Jagriti UID: 22BCS14515
Branch: BE CSE Section/Group: KPIT-902-B
Semester: 6th Date of Performance:07/01/25
Subject Name: JAVA Subject Code: 22CSH-359
1. Aim:
Create an application to save the employee information using arrays in Java.
2. Objective:
• Implement an array to store employee information such as Employee ID, Name,
Designation, and Salary.
• Perform Create, Read, Update, and Delete operations on the employee data stored in the
array.
• Develop methods to access specific employee records and modify or delete them based on
user input.
• Display the stored employee data in a structured format to verify the correctness of the
operations.
3. Implementation/Code:
import java.util.*;
public class Main
{
public static void main(String[] args)
{
int[] empId = {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[] desigCode = {'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};
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
int[] IT = {3000, 9000, 1000, 2000, 20000, 4400, 10000};
Scanner sc = new Scanner(System.in);
System.out.println("Enter the employee ID: ");
int x = sc.nextInt();
int index =-1;
for (int i = 0; i < empId.length; i++)
{
if (empId[i] == x)
{
index =i;
break;
}
}
if(index==-1)
{
System.out.println("Employee with ID " + x + " not found.");
}
else
{
String designation = "";
int da=0;
switch (desigCode[index])
{
case 'e': designation = "Engineer"; da =20000; break;
case 'c': designation = "Consultant"; da =20000; break;
case 'k': designation = "Clerk"; da =20000; break;
case 'r': designation = "Receptionist"; da =20000; break;
case 'm': designation = "Manager"; da =20000; break;
}
int salary = basic[index] + HRA[index]+da - IT[index];
System.out.println("Emp ID: " + empId[index]);
System.out.println("Emp Name: " + empName[index]);
System.out.println("Join Date: " + joinDate[index]);
System.out.println("Department: " + dept[index]);
System.out.println("Designation: " + designation);
System.out.println("Salary: " + salary);
}
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
sc.close();
}
}
4. Output:
5. Learning Outcome
• Acquire hands-on experience in utilizing arrays to store and manage multiple records of
similar types.
• Understand how to systematically create, read, update, and delete data within an
application.
• Enhance logical thinking and problem-solving skills by designing a basic system for
managing employee data.
• Improve Java programming proficiency, including working with classes, methods, loops,
and custom functions.