电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

某公司的雇员分为以下若干类Employee这是所有员工总的父类属性员工的姓名和生日月份方法根据月份定工资

某公司的雇员分为以下若干类Employee这是所有员工总的父类属性员工的姓名和生日月份方法根据月份定工资_第1页
1/6
某公司的雇员分为以下若干类Employee这是所有员工总的父类属性员工的姓名和生日月份方法根据月份定工资_第2页
2/6
某公司的雇员分为以下若干类Employee这是所有员工总的父类属性员工的姓名和生日月份方法根据月份定工资_第3页
3/6
Employee.ava import java.util.Calendar; import java.util.GregorianCalendar; public class Employee { /** * Employee:这是所有员工总的父类,属性:员工的姓名和生日月份。方法:getSalary(int month) 根据参数月份来确定工资, * 如果该月员工过生日,则公司会额外奖励 100 元。 */ private String name; protected int month; private int base = 6000; private int salary; public Employee() { } public Employee(String name, int month) { this.setName(name); this.setMonth(month); } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getMonth() { return month; } public void setMonth(int month) { this.month = month; } GregorianCalendar g = new GregorianCalendar(); int flag = (int) g.get(Calendar.MONTH) + 1; public int getSalary(int month) { int s = this.getMonth(); if (flag == s) { salary = base + 100; } else salary = base; return salary; } void says() { System.out.println("当前月份:" + flag); } } // SalaryEmployee:Employee 的子类,拿固定工资的员工。属性:月薪 class SalaryEmployee extends Employee { private int base = 6000; private int salary; public SalaryEmployee(String name, int month) { super(name, month); } public int getSalary(int month) { int s = this.getMonth(); if (flag == s) { salary = base + 100; } else { salary = base; } return salary; } void says() { System.out.println(" " + "姓名:" + this.getName() + " " + "生日所在月:" + this.getMonth() + " " + "所得薪酬:" + getSalary(month)); } } // HourlyEmployee:Employee 的子类,按小时拿工资的员工,每月工作超出160 小时的部分按照1.5 倍工资发放。 // 属性:每小时的工资、每月工作的小时数 class HourlyEmployee extends Employee { private int hours; private int basehour = 35; private int salary; public HourlyEmployee(String name, int month, int hours) { ...

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

某公司的雇员分为以下若干类Employee这是所有员工总的父类属性员工的姓名和生日月份方法根据月份定工资

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部