



免费预览已结束,剩余1页可下载查看
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
某公司的雇员分为以下若干类: Employee:这是所有员工总的父类,属性:员工的姓名和生日月份。 方法:getSalary(int month) 根据参数月份来确定工资,如果该月员工过生日, 则公司会额外奖励100元。 SalariedEmployee:Employee的子类,拿固定工资的员工。属性:月薪 HourlyEmployee:Employee的子类,按小时拿工资的员工,每月工作超出160 小时的部分按照1.5倍工资发放 属性:每小时的工资、每月工作的小时数 SalesEmployee:Employee的子类,销售人员,工资由月销售额和提成率决定 属性:月销售额、提成率 BasePlusSalesEmployee:SalesEmployee的子类,有固定底薪的销售人员, 工资由底薪加上销售提成部分 属性:底薪。class Employeeprivate String name;private int birthmonth;public Employee()public Employee(String name,int birthmonth)this.setName(name);this.setBirthmonth(birthmonth);public void setName(String name) = name;public String getName() return name;public void setBirthmonth(int birthmonth) this.birthmonth = birthmonth;public int getBirthmonth() return birthmonth;public int getSalary(int month) if(month=this.getBirthmonth()return 100;else return 0;public void print()System.out.print(该员工信息:+姓名:+this.getName()+ 出生月份:+this.getBirthmonth()+月 工资:);class SalaryEmployee extends Employeeprivate int salary; public SalaryEmployee(String name,int birthmonth,int salary)super(name,birthmonth);setSalary(salary); public int getSalary() return salary;public void setSalary(int salary) this.salary = salary;public int getSalary(int month) return this.salary+super.getSalary(month); class HourlyEmployee extends Employeeprivate int hour;private int salary;public HourlyEmployee(String name,int birthmonth,int salary,int hour)super(name,birthmonth);setSalary(salary);setHour(hour);public int getHour() return hour;public void setHour(int hour) this.hour = hour;public int getSalary() return salary;public void setSalary(int salary) this.salary = salary;public int getSalary(int month) if(hour160)return (int) (this.salary*160+(this.hour-160)*this.salary*1.5+super.getSalary(month);elsereturn (int) (this.salary*this.hour+super.getSalary(month);class SalesEmployee extends Employeeprivate int sale;private float commission;public SalesEmployee()public SalesEmployee(String name,int birthmonth,int sale,float commission)super(name,birthmonth);setSale(sale);setCommission(commission);public int getSale() return sale;public void setSale(int sale) this.sale = sale;public float getCommission() return commission;public void setCommission(float commission) mission = commission;public int getSalary(int month) return (int)(this.sale*mission+super.getSalary(month);class BasePlusSalesEmployee extends SalesEmployeeprivate int basesalary;public BasePlusSalesEmployee(String name,int birthmonth,int sale,int commission,int basesalary)setName(name);setBirthmonth(birthmonth);setSale(sale);setCommission(commission);setBasesalary(basesalary);public int getBasesalary() return basesalary;public void setBasesalary(int basesalary) this.basesalary = basesalary;public int getSalary(int month) return (int)(super.getSale()*super.getCommission()+this.basesalary+super.getSalary(month);public class TestEmployee public static void main(String args) SalaryEmployee a=new SalaryEmployee(张三,2,3000);a.print();System.out.println(a.getSalary(3);HourlyEmployee a1=new HourlyEmployee(李四,2,10,200);a1.print();System.out.println(a1.getSalary(2);SalesEmployee a2=new SalesEmployee(王五,2,10000, 0.2f
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年福建省大学生志愿服务乡村振兴计划招募500人考前自测高频考点模拟试题及答案详解(易错题)
- 2025年上半年四川泸州市龙马潭区考试选调机关事业单位人员17名考前自测高频考点模拟试题及答案详解(新)
- 2025广西河池市大化瑶族自治县特殊教育学校招聘公益性岗位工作人员2人考前自测高频考点模拟试题附答案详解(典型题)
- 2025辽宁长海县银龄教师招聘6人模拟试卷带答案详解
- 四川中科青翼智能科技有限公司公开招聘笔试历年参考题库附带答案详解
- 2025黑龙江哈尔滨电气集团有限公司校园招聘370人笔试历年参考题库附带答案详解
- 2025年应急管理部所属单位第二批次公开招聘(秦皇岛有岗)考前自测高频考点模拟试题含答案详解
- 2025江苏常州市钟楼金隆控股集团有限公司招聘第一批人员考前自测高频考点模拟试题及答案详解一套
- 2025年第二次调整湖南省烟草专卖局系统考试聘用工作人员部分职位计划的模拟试卷参考答案详解
- 2025贵州航天控制秋季招聘笔试历年参考题库附带答案详解
- DB51∕T 3060-2023 四川省政务信息化后评价指南
- 2025年四川省机关事业单位考调/选调工作人员考试(综合知识/综合应用能力测试)历年参考题库含答案详解(5套)
- DB4201∕T 645-2021 房地产经纪服务规范
- 2025-2030中国燃气供应系统(FGSS)行业经营现状及未来前景展望报告
- 板块六 学案40 赏析意象(景象)与意境-分析内涵品象悟境
- 村集体山林管理办法
- 数独教学课件
- 海绵印拓画课件
- 2025年科技创新与成果转化的知识能力考核试题及答案
- 2025至2030中国惯性导航行业投资现状与前景预测分析报告
- 轻型卒中临床诊疗中国专家共识(2024版)解读
评论
0/150
提交评论