⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 department.java

📁 公司:<公司名>
💻 JAVA
字号:
package secondExam;

/**
 * 部门类
 * 
 * @author HOLLY
 * 
 */
public class Department {
	private String name;
	private Employee[] employees;

	/**
	 * 对部门的姓名和部门里的员工进行初始化
	 * 
	 * @param name
	 * @param employees
	 */
	public Department(String name, Employee[] employees) {
		super();
		this.name = name;
		this.employees = employees;
	}

	/**
	 * 得到部门的总工资数
	 * 
	 * @return
	 */
	public double getSalary() {
		double salary = 0;
		for (Employee employee : employees) {
			salary += employee.getSalary();
		}
		return salary;
	}

	/**
	 * 得到部门的总奖金数目
	 * 
	 * @return
	 */
	public double getInsurance() {
		double insurance = 0;
		for (Employee employee : employees) {
			insurance += employee.getInsurance();
		}
		return insurance;
	}

	/**
	 * 得到部门名称
	 * 
	 * @return
	 */
	private String getName() {
		return name;
	}

	/**
	 * 打印出部门的相关信息
	 */
	public void print() {
		System.out.printf("%s , %f , %f ", getName(), getSalary(),
				getInsurance());
		System.out.println();
		for (Employee employee : employees) {
			employee.print();
		}
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -