Java implementation of employee management system

This example shares the specific code of Java employee management system for your reference. The specific contents are as follows

The main contents of this system are as follows:

1. Process control statement 2, class, object 3, encapsulation, inheritance, polymorphism 4, method overloading, rewriting 5, access modifier 6, static

Requirements Description:

Basic information of employee information ―――――――――――――――――――――――― C attribute: employee number, employee name, employee position, leave days, basic salary. Salary of ordinary employees: 10% working meal and 50% post subsidy will be added to the basic salary, 200 yuan housing subsidy basic salary + basic salary * 0.1 + basic salary * 0.5 + 200 ――――――――――――――――――――――――――――――――――――――――― C attribute: employee number, employee name, employee position, leave days, basic salary manager salary: 20% working meal and 50% post subsidy are added on the basis of basic salary, 500 yuan housing subsidy basic salary + basic salary * 0.2 + basic salary * 0.5 + 500 ―――――――――――――――――――――――――――――――――――― C attribute: employee number, employee name, employee position, leave days, basic salary director's salary: 8% working meal, 30% post subsidy and 2000 yuan housing subsidy are added on the basis of basic salary, 3000 yuan investment subsidy basic salary + basic salary * 0.08 + basic salary * 0.3 + 2000 + 3000 ――――――――――――――――――――――――――――――――― salary deduction part. All employees do not ask for leave. The basic salary is paid in full. If they ask for leave, the average salary per day * leave days will be deducted

General design idea:

There is one employee parent class, one ordinary employee, one manager, and one director child class, which override the salary method of the parent class respectively. The last test class. The interface after implementation is shown in the figure:

There is no problem with the preparation of parent and child classes. Pay attention to encapsulation as much as possible, and private modification is best for attributes. Xiaobian is lazy and spends his time writing test classes ε  ̄*)o。 Note: since the system only stores objects in the object array, and the fixed length is set to 100 during array initialization, the system will automatically initialize each array element to be null. Therefore, when writing test class methods, you must pay attention to writing judgment to prevent null pointer errors in traversal assignment. Small editing is stupid, So it took a long time to write it out (v_v). Also, when changing the employee's information, pay attention to what to do if the employee's position changes. After all, the object changes and the method of dealing with wages is different.

The following codes are posted:

The first is the parent class employee

Three subclasses:

The next step is the key test class. Here, add, delete, modify and check = = a little more.

Just after the program was written, I came to post. No problems were found in the simple test. If you find anything wrong, please correct it. Thank you.

For more learning materials, please pay attention to the special topic "management system development".

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>