-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStaff.java
40 lines (39 loc) · 1.17 KB
/
Staff.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package stia1123_test2;
/**
*
* @author Amiful Luqman
*/
public class Staff {
private String name, id;
private Income income;
Staff(){
}
Staff(String name, String id, Income income){
this.name = name;
this.id = id;
this.income = income;
}
String getname(){
return name;
}
String getid(){
return id;
}
public double calculateNetIncome(){
return income.getAmount()-income.getTotalTax();
}
void displayStaffInfo(){
System.out.println("<<<< STAFF INFO >>>>>");
System.out.println("Name: "+ this.name);
System.out.println("ID: " + this.id);
System.out.println("");
}
void displayIncomeInfo(){
System.out.println("<<<< INCOME INFO >>>>");
System.out.println("Income amount: RM " + income.getAmount());
System.out.println("Tax: " + income.getTax() + "%");
System.out.println("Total Tax Paid: RM " + income.getTotalTax());
System.out.println("Total Net Income: RM " + calculateNetIncome());
System.out.println("Income type: " + income.getIncomeType());
}
}