


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Java is a high-level, class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible.
Typology: Summaries
1 / 4
This page cannot be seen from the preview
Don't miss anything!



package exp_1; import java.util.Objects; import java.util.Scanner; public class Exp1 { public static int getSalary(String[][] arr, int i) { int DA=0; if(Objects.equals(arr[i][3], "e")){ DA+=20000; } else if(Objects.equals(arr[i][3], "c")){ DA+=32000; } else if(Objects.equals(arr[i][3], "k")){ DA+=12000; } else if(Objects.equals(arr[i][3], "r")){ DA+=15000; } else if(Objects.equals(arr[i][3], "m")){ DA+=40000; } return DA; } public static void printJi(int empId, String[][] arr) { int i=0; int basic= Integer.parseInt(arr[i][5]);
int HRA=Integer.parseInt(arr[i][6]); int IT=Integer.parseInt(arr[i][7]); if (empId == 1001) { i = 0; } else if (empId == 1002) { i = 1; } else if (empId == 1003) { i = 2; } else if (empId == 1004) { i = 3; } else if (empId == 1005) { i = 4; } else if (empId == 1006) { i = 5; } else if (empId == 1007) { i = 6; } else { System.out.println("employee id is wrong"); return; } String Designation = printDesg(arr, i); int DA= getSalary(arr,i); int salary= basic+HRA+DA-IT; System.out.println("Emp id Emp name Deparment Designation Salary"); System.out.println(empId +" "+ arr[i][1] +" "+ arr[i][4] +" "+ Designation + " "+salary); } public static String printDesg(String[][] arr, int i) { StringBuilder Stdesg= new StringBuilder(); Stdesg.append(arr[i][3]); String desg=Stdesg.toString(); String send="none"; switch (desg) { case "e": send="engineer"; case "c": send="Consultant"; case "k": send= "Clerk";