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!

class employees {personal double pay; / ** * The value of salary is "New Cycle" * / Public Zero Set Setri (Double New Shelter) {Pay = New Shelley; } / ** * Current value of salary / returns / public double getSalary () {return salary; }

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

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

lua - HowTo create a fuel bar -