第二十五天实训!!!

在一个公司管理信息系统中,包括
普通员工( Employees) 其可能有的属性信息包括
员工号( employeeNumber
姓名( name
地址( address
工作年限( year
工资 基本工资 2000 + 年限* 100
管理者( Magagers ) 除具有普通员工所具有的属性及行为外,还具有下面的属性和行为
职责( responsibilities
工资的计算方法与一般员工不同;普通员工的基本工资 2 + 年限 *200
试用继承方式实现该功能

父类代码:

package com.Sru;



public class Person {
 protected  String employeeNumber, name, address ;
 int salary,year;
 public Person(){
 
 }
 public Person(String eEmployeeNumber,String nName, String aAddress,int sSalary,int yYear){
 employeeNumber = eEmployeeNumber;
 name = nName;
 address = aAddress;
 year = yYear;
 salary = sSalary;
 }
      public int salary(){
     
     
          return (salary=2000+(int)(year)*100);
      }

}

子类代码

package com.Sru;


public class Son extends Person {
protected String responsibilities;int salary;
public Son (String rResponsibilities, int sSalary) {
responsibilities = rResponsibilities;
salary = sSalary;
 
}
public int salary(){
     
     
         return (salary=4000+(int)(year)*200);
     }
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值