Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

a structured testing process is essential: Input File: An input file is provided containing a series of commands de - signed to simulate the different

a structured testing process is essential:
Input File: An input file is provided containing a series of commands de- signed to simulate the different operations the EmployeeManagementSys- tem can perform, such as adding employees, approving leaves, changing employee states, and more.
Execution: The testing should be performed within the main method of your system. By running your system with this input file, the Employ- eeManagementSystem will process each command sequentially, mirroring real-world usage scenarios.
Output File: Concurrently, an output file will be generated, containing the results of processing all commands from the input file. This file serves as a tangible record of the systems responses to each operation.
Expected Outcomes: The essence of testing lies in comparing the actual output generated by your system against the expected output detailed in the testing documentation. A match between these outputs indicates that the system functions correctly and as expected, affirming its reliability in managing employee records accurately.
Important Note on Bonus Calculation
For the purpose of simplification and to ensure consistency in testing, the bonus percentages for each employee type have been predefined as follows:
Designer: A bonus rate of 0.10(10%) of their salary.
Developer: A bonus rate of 0.12(12%) of their salary.
Manager: A bonus rate of 0.15(15%) of their salary.
When calculating bonuses for each employee type, the system must apply these specific rates.
do that on these classes:
public abstract class Employee {
private String name;
private int id;
private double salary;
public Employee(String name, int id, double salary){
this.name = name;
this.id = id;
this.salary = salary;
}
public String getName(){
return name;
}
public void setName(String name){
this.name = name;
}
public int getId(){
return id;
}
public void setId(int id){
this.id = id;
}
public double getSalary(){
return salary;
}
public void setSalary(double salary){
this.salary = salary;
}
public abstract double calculateBonus();
}
public interface Approver {
void approveLeave(int employeeId, LocalDate startDate, int days);
void markEmployeeAsWorking(int employeeId);
}
public class Manager extends Employee implements Approver {
public Manager(String name, int id, double salary){
super(name, id, salary);
}
@Override
public double calculateBonus(){
return getSalary()*0.2; // Example bonus calculation
}
@Override
public void approveLeave(int employeeId, LocalDate startDate, int days){
// Implementation for approving leave
}
@Override
public void markEmployeeAsWorking(int employeeId){
// Implementation for marking employee as working
}
}
public class Developer extends Employee {
public Developer(String name, int id, double salary){
super(name, id, salary);
}
@Override
public double calculateBonus(){
return getSalary()*0.15; // Example bonus calculation
}
}
public class Designer extends Employee {
public Designer(String name, int id, double salary){
super(name, id, salary);
}
@Override
public double calculateBonus(){
return getSalary()*0.1; // Example bonus calculation
}
}
import java.time.LocalDate;
public class Leave {
private Employee employee;
private LocalDate startDate;
private int duration;
public Leave(Employee employee, LocalDate startDate, int duration){
this.employee = employee;
this.startDate = startDate;
this.duration = duration;
}
public Employee getEmployee(){
return employee;
}
public LocalDate getStartDate(){
return startDate;
}
public int getDuration(){
return duration;
}
}
public class EmployeeManagementSystem {
private List employees = new ArrayList<>();
public String addEmployee(Employee employee){
employees.add(employee);
return "Employee added successfully.";
}
public String removeEmployee(int id){
Employee employee = findEmployeeById(id);
if (employee != null){
employees.remove(employee);
return "Employee removed successfully.";
} else {
return "Employee not found.";
}
}
public String printAllEmployees(){
StringBuilder sb = new StringBuilder();
for (Employee employee : employees){
sb.append("Name: ").append(employee.getName())
.append(", ID: ").append(employee.getId())
.append(", Salary: ").append(employee.getSalary())
.append(", Bonus: ").append(employee.calculateBonus())
.append("
");
}
return sb.toString();
}
public String approveLeave

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database And Transact SQL

Authors: Lucy Scott

1st Edition

1974679985, 978-1974679980

More Books

Students also viewed these Databases questions