0% found this document useful (0 votes)
46 views5 pages

Shanu Java 1.1

The document describes a Java program that uses arrays to store and manage employee information. The program allows users to input an employee number and retrieves the corresponding employee name, department, designation, and calculated salary from the stored arrays. It implements error handling to check if the entered employee number exists in the array. The aim is to create an application to save employee data using arrays and allow efficient retrieval and modification of information with a user-friendly interface.

Uploaded by

Deb
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)
46 views5 pages

Shanu Java 1.1

The document describes a Java program that uses arrays to store and manage employee information. The program allows users to input an employee number and retrieves the corresponding employee name, department, designation, and calculated salary from the stored arrays. It implements error handling to check if the entered employee number exists in the array. The aim is to create an application to save employee data using arrays and allow efficient retrieval and modification of information with a user-friendly interface.

Uploaded by

Deb
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/ 5

DEPARTMENT OF

COMPUTER SCIENCE & ENGINEERING

Experiment1.1

Student Name: Shanu Kumar UID: 21BCS9043


Branch: B.E CSE Section/Group: CC_646_A
Semester: 6th Date of Performance: 13-01-24
Subject Name: JAVA Subject Code: 21CSP-314

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

2. Objective: Develop an application using arrays to efficiently manage


employee information, allowing users to input, store, retrieve, and modify
data with a user-friendly interface, while implementing error handling for
data consistency and reliability.

3. Program Code:
import java.util.*;
class Lab1
{
public static void main(String... args)
{
int empno[]={1001,1002,1003,1004,1005,1006,1007};
String empname[]={"Pranshu
Mishra","Rudra","Vipul","Parv","Ram","Lucky","Tanmay"};
String designationcode[]={"e","c","k","r","m","e","c"};
String department[]={"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};
String designationcodemean[]={"e","c","k","r","m"};
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

String
designation[]={"Engineer","Consultant","Clerk","Receptionist","Manager"};
int da[]={20000,32000,12000,15000,40000};
Scanner sc=new Scanner(System.in);
System.out.println("Enter employee number : ");
int empnumber=sc.nextInt();
String designationofemployee[];
designationofemployee=new String[7];
int da_sal[];
da_sal=new int[7];
int salary[];
salary=new int[7];
for(int a=0;a<7;a++)
{
if(designationcode[a]=="e")
{
designationofemployee[a]="Engineer";
da_sal[a]=20000;
}
else if(designationcode[a]=="c")
{
designationofemployee[a]="Consultant";
da_sal[a]=32000;
}
else if(designationcode[a]=="k")
{
designationofemployee[a]="Clerk";
da_sal[a]=12000;
}
else if(designationcode[a]=="r")
{
designationofemployee[a]="Receptionist";
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

da_sal[a]=15000;
}
else if(designationcode[a]=="m")
{
designationofemployee[a]="Manager";
da_sal[a]=40000;
}
}
for(int b=0;b<7;b++)
{
salary[b] = basic[b] + hra[b] + da_sal[b] - it[b];
}

for(int i=0;i<=7;i++)
{
if(i==7)
{
System.out.println("there is no employee with empid:
"+empnumber);
break;
}
else if(empno[i]==empnumber)
{
System.out.print(empno[i]+" "+empname[i]+"
"+department[i]+" "+designationofemployee[i]+" "+salary[i]);
break;
}
}
}
}
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

4. Output:

Output 1

Output 2

5. Learning Outcomes:

 Learn the concept of JAVA.

 Learn about arrays in JAVA.

 Learn about conditional statements.

 Learn about User Input and Output.

 Learn different data-types.


DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

You might also like