全文预览

面向对象程序设计 课件

上传者:非学无以广才 |  格式:docx  |  页数:19 |  大小:474KB

文档介绍
mployee(float salary,String empid,int age,String name,String sex){Р super(salary,empid,age,name,sex);Р }Р?public float getSalary() {Р Р return super.salary;Р?}Р?Р?public void role() {Р System.out.println("姓名:"+super.getname()+"\t年龄:"Р+super.getage()+"\t性别:"+super.getsex()+"\t薪水:"+super.salary+"\t编号:"+super.empid);Р?}Р}РHourlyEmployee类Р.sy4.exe02.test;Рpublic class HourlyEmployee extends Employee {Р?float hoursalary;Р?float hourwork;Р?float money;Р?public HourlyEmployee(String empid,int age,String name,String sex,float hoursalary,float hourwork){Р super(0,empid,age,name,sex);Р this.hoursalary=hoursalary;Р this.hourwork=hourwork;Р }Р?public float getSalary() {Р if(hourwork<=160)Р money=hoursalary*hourwork;Р elseР money=(float) (hoursalary*160+(hourwork-160)*hoursalary*1.5);Р return money;Р?}

收藏

分享

举报
下载此文档