public class Employee {
private String department;
private String title;
private Double salary, bonus, wage, tax;
private String name;
// The constructor method
public Employee(String employeeDepartment, String employeeTitle, String employeeName, Double employeeSalary)
{
name = employeeName;
title = employeeTitle;
salary = employeeSalary;
department = employeeDepartment;
//computing bonus, taxes and wages
bonus = (bonus_rate/100)* salary;
tax = (tax_rate/100) * salary;
wage = (salary + bonus)- tax;
}
// A method to display the state of the object to the screen
public void displayEmployeeDetails()
{
System.out.println("Name: " + name);
System.out.println("Title: " + title);
System.out.println("Department: " + department);
System.out.println("Salary: " + salary + ". ");
System.out.println("Wage: " + wage);
System.out.println("Taxes: " + tax);
System.out.println("Bonus: " + bonus);
}
}
0 comments:
Post a Comment