직원 급여 분석
여러분은 한 기술 기업의 직원 데이터를 분석하고 있어요. 인사(HR) 부서에서는 모든 직원의 급여를 10% 인상하려고 합니다. 각 급여 값을 변환하고 그 결과를 새 열로 추가하세요.
Tablesaw 라이브러리는 이미 import되어 있으며, employees.csv에는 Name, Department, Salary, Bonus 열이 포함되어 있습니다.
이 연습은 강의의 일부입니다
Java에서 데이터 가져오기
연습 안내
- 각 직원의 급여에 10% 인상을 적용하도록 변환을 수행하세요.
- 조정된 새 급여 열을 표에 추가하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
public class EmployeeSalary {
public static void main(String[] args) {
Table employees = Table.read().csv("employees.csv");
// Apply transformation for 10% increase
DoubleColumn adjustedSalary = employees.intColumn("Salary")
.asDoubleColumn()
.____(salary -> salary * ____);
// Add new column to table
employees.____(adjustedSalary.setName("AdjustedSalary"));
System.out.println("Employee Salary Analysis:");
System.out.println(employees.first(5));
}
}