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
DEPARTMENT OF
COMPUTER SCIENCE &
Experiment - 1
Student Name: UID: 22BCS
Branch: Be-CSE Section/Group:22BCS Semester: 6th Date of Performance:10/01/25 Subject Name: PBLJ with lab Code: 22CSH-359
1. Aim: Create an application to save the employee information using arrays.
2. Objective: The objective of this experiment is to develop a Java application that stores employee data using arrays, retrieves specific details based on user input, and calculates employee salaries dynamically. The application utilizes conditional logic, such as loops and switch-case, to determine the employee's designation and related allowances, demonstrating the practical implementation of basic programming concepts in Java. 3. Implementation/Code: import java.util.Scanner; public class employee { 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"};
int[] hra = {8000, 12000, 8000, 6000, 20000, 9000, 12000}; int[] it={3000, 9000, 1000, 2000, 20000, 4400, 10000}; System.out.println("Enter the id to find data: "); int empId=sc.nextInt(); boolean found=false; DEPARTMENT OF COMPUTER SCIENCE &
break; } } if(!found){ System.out.println("There is no employee with empid: " +empId); } } }
4. Output:
5. Learning Outcome:
1. Understood how to use arrays to store and retrieve structured data.
2. Learned the application of switch-case for conditional logic. 3. Gained experience in calculating and displaying output in a formatted manner using Java. 4. Improved problem-solving skills by handling scenarios like invalid input. 5. Developed skills to handle invalid inputs and provide appropriate feedback to the user.