0% found this document useful (0 votes)
6 views2 pages

Employee Salary Management System

The Java program defines an Employee class and a Solution1 class that manages an array of Employee objects. It allows for input of employee details, calculates the number of employees within a specified salary range, and identifies the employee with the highest salary. The program outputs the results based on user input for salaries and employee details.

Uploaded by

veena16118
Copyright
© All Rights Reserved
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
0% found this document useful (0 votes)
6 views2 pages

Employee Salary Management System

The Java program defines an Employee class and a Solution1 class that manages an array of Employee objects. It allows for input of employee details, calculates the number of employees within a specified salary range, and identifies the employee with the highest salary. The program outputs the results based on user input for salaries and employee details.

Uploaded by

veena16118
Copyright
© All Rights Reserved
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

import java .util.

Scanner;
public class Solution1 {
public static void main(String[] args)
{
Employee[] emps=new Employee[5];
Scanner sc=new Scanner([Link]);
for(int i=0;i<[Link];i++) {
int empId=[Link]();
[Link]();
String empName=[Link]();
int mgrId=[Link]();
[Link]();
String deptName=[Link]();
double salary=[Link]();
[Link]();
emps[i]= new Employee(empId,empName,mgrId,deptName,salary);
}
double maxSal1=[Link]();
[Link]();
double minSal1=[Link]();
[Link]();
int output1=findempsWithSalRange(emps,minSal1,maxSal1);
if(output1 >0) {
[Link](output1);
}else {
[Link]("No Employees in the given range");
}
Employee output2=getEmployeeWitMaxSal(emps);
[Link]([Link]()+"#"+[Link]()
+"#"+[Link]());
}

public static int findempsWithSalRange(Employee[] emps,double


minSal,double maxSal)
{
int count=0;
for(Employee e:emps) {
if(maxSal > [Link]() && [Link]() < minSal ) {
count=count+1;
}
}return count;
}
public static Employee getEmployeeWitMaxSal(Employee[] emps)
{
for(int i=0;i<[Link];i++) {
for(int j=i+1;j<[Link];j++) {
if(emps[i].getSalary()<emps[j].getSalary()) {
Employee temp=emps[i];
emps[i]=emps[j];
emps[j]=temp;
}
}
}return emps[0];

}
}
public class Employee {
private int empId;
private String empName;
private int mgrId;
private String deptName;
private double salary;
public int getEmpId() {
return empId;
}
public void setEmpId(int empId) {
[Link] = empId;
}
public String getEmpName() {
return empName;
}
public void setEmpName(String empName) {
[Link] = empName;
}
public int getMgrId() {
return mgrId;
}
public void setMgrId(int mgrId) {
[Link] = mgrId;
}
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
[Link] = deptName;
}
public double getSalary() {
return salary;
}
public void setSalary(double salary) {
[Link] = salary;
}
public Employee(int empId, String empName, int mgrId, String deptName, double
salary) {
super();
[Link] = empId;
[Link] = empName;
[Link] = mgrId;
[Link] = deptName;
[Link] = salary;
}

You might also like