Java Questions! About List and Objects -
I have a list (linked list) that contains some objects I more specifically, list the employee list It is said that my employee stores items
I want to make a method in the class staff list which can increase the salaries of each employee once in the list.
How will anyone reach him?
Great thanks!
something like that
double increment = 10000; (Employee employee: theList) {double salary = employee .getSalary (); Employee.setSalary (salaryNow + increase); }
Caution - you should never use double
to store the amount of money, because you can get the floating point round Errors will be subject to errors. Instead please use BigDecimal
. I did this only in this snippet for your match in your employee
category.
Comments
Post a Comment