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

HTML

The document contains Java classes for managing employee details and business logic, including methods for calculating yearly salary and appraisal based on monthly salary. The EmployeeDetails class has attributes for name, monthly salary, and age, with corresponding getter and setter methods. A test class verifies the appraisal calculation functionality using JUnit, ensuring that employees with a monthly salary below 10,000 receive a 500 appraisal.

Uploaded by

samip rawal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views2 pages

HTML

The document contains Java classes for managing employee details and business logic, including methods for calculating yearly salary and appraisal based on monthly salary. The EmployeeDetails class has attributes for name, monthly salary, and age, with corresponding getter and setter methods. A test class verifies the appraisal calculation functionality using JUnit, ensuring that employees with a monthly salary below 10,000 receive a 500 appraisal.

Uploaded by

samip rawal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

public class EmployeeDetails {

private String name ;


private double Monthlysalary ;
private int age ;

public String getName() {


return name;

}
public double getMonthlysalary() {
return Monthlysalary;
}
public int getage() {
return age;
}

public void setAge(int age) {


this.age = age;
}
public void setName(String name) {
this.name = name;
}
public void setMonthlysalary(double monthlysalary) {
Monthlysalary = monthlysalary;
}

public class EmpBunsinessLogic {


public double calculateYearlysalary (EmployeeDetails employeeDetails) {
double yearlySalary = 0;
yearlySalary = employeeDetails.getMonthlysalary();
return yearlySalary;
}
public double calculateAppraisal(EmployeeDetails employeedetails) {
double Appraisal = 0;
if (employeedetails.getMonthlysalary()<10000) {
Appraisal = 500;
}
else {Appraisal = 1000;
}
return Appraisal;
}
}
//import static org.junit.Assert.assertEquals;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

public class TestEmployeeDetails {


EmpBunsinessLogic empBusinessLogic = new EmpBunsinessLogic();
EmployeeDetails employee = new EmployeeDetails();
@Test
public void testClaculateAppraisal() {
employee.setName("samip");
employee.setAge(19);
employee.setMonthlysalary(1570);
double Appraisal = empBusinessLogic.calculateAppraisal(employee);
assertEquals(500,Appraisal,0.0);

You might also like