Java期末复习重点题目_绩效管理系统

1)设计一个员工类Employee,有属性:工号,姓名,性别,出生年月,职称

2)设计员工类的子类:

教师Teacher:                    扩展属性: 教学工作量,科研工作量

                                           扩展功能:教学,做科研

科研人员ResearchStaff:  扩展属性:科研工作量

                                           扩展功能:做科研

3)设计接口绩效计算: PerformanceCalculation

 4)在教师和科研人员子类中实现接口函数计算各自的绩效以及打印人员信息

教师的绩效计算公式:

(教学工作量 - 320)/ 320 +(科研工作量-75/ 75

科研人员的绩效计算公式:

(科研工作量 - 400/ 400

5)设计绩效管理系统类,设计绩效计算函数:通过循环计算所有员工的绩效,并打印

6)如果增加实验员类别,请修改代码计算绩效

实验员LaboratoryAssistant:扩展属性:实验工作量,科研工作量

                                              扩展功能:上实验课,做科研

实验员绩效计算公式:实验工作量 - 240)/ 240 +(科研工作量 - 75/ 75

public interface PerformanceCalculation {
	Double doPerformanceCalculation();//接口函数:绩效计算
}
public class Employee {
	String number;//工号
	String name;//姓名
	int sex;//性别
	String birthing;//出生
	String professionalTitles;//职称
	
	Employee(){		
	}
	//有参构造方法初始化数据
	Employee(String number, String name, int sex, String birthing, String professionalTitles){
		this.number=number;
		this.name=name;
		this.sex=sex;
		this.birthing=birthing;
		this.professionalTitles=professionalTitles;
	}
}

public class Teacher extends Employee implements PerformanceCalculation{
	double teachingLoad;//教学工作量
	double researchLoad;//科研工作量
	double calculation;//绩效
	
	Teacher(){		
	}
	//有参构造方法初始化数据
	Teacher(String number, String name, int sex, String birthing, String professionalTitles, double teachingLoad,double researchLoad){
		super(number, name, sex, birthing, professionalTitles);
		this.teachingLoad=teachingLoad;
		this.researchLoad=researchLoad;
	}
	
	//教学方法
	void doTeaching(){
		System.out.println(name+professionalTitles+"在教学");
	}
	
	//做科研方法
	void doReSearch(){
		System.out.println(name+professionalTitles+"在做科研");
	}

	public Double doPerformanceCalculation() {
		System.out.println(name+"("+number+"):"+"教学工作量:"+teachingLoad+",  "+"科研工作量:"+researchLoad);
		calculation=(teachingLoad-320)/320+(researchLoad-75)/75;//计算绩效
		System.out.println(name+"的绩效:"+calculation);//输出绩效
		return calculation;//返回绩效
	}
}
public class ResearchStaff extends Employee implements PerformanceCalculation{
	double researchLoad;//科研工作量
	double calculation;//绩效
	
	ResearchStaff(){
	}
	//有参构造方法初始化数据
	ResearchStaff(String number, String name, int sex, String birthing, String professionalTitles, double researchLoad){
		super(number, name, sex, birthing, professionalTitles);
		this.researchLoad=researchLoad;
	}
	//做科研
	void doReSearch(){
		System.out.println(name+professionalTitles+"在做科研");
	}

	public Double doPerformanceCalculation() {
		System.out.println(name+"("+number+"):"+"科研工作量:"+researchLoad);
		calculation=(researchLoad-400)/400;//计算绩效
		System.out.println(name+"的绩效:"+calculation);//输出绩效
		return calculation;//返回绩效
	}
}

public class LaboratoryAssistant extends Employee implements PerformanceCalculation{
	double laboratoryLoad;//实验工作量
	double researchLoad;//科研工作量
	double calculation;//绩效
	
	LaboratoryAssistant(){
	}
	//有参构造方法初始化数据
	LaboratoryAssistant(String number, String name, int sex, String birthing, String professionalTitles, double laboratoryLoad,double researchLoad){
		super(number, name, sex, birthing, professionalTitles);
		this.laboratoryLoad=laboratoryLoad;
		this.researchLoad=researchLoad;
	}
	//实验教学
	void doLaboratory(){
		System.out.println(name+professionalTitles+"在上实验课");
	}
	
	//做科研
	void doReSearch(){
		System.out.println(name+professionalTitles+"在做科研");	
	}

	public Double doPerformanceCalculation() {
		System.out.println(name+"("+number+"):"+"实验工作量:"+laboratoryLoad+",  "+"科研工作量:"+researchLoad);
		calculation=(laboratoryLoad-240)/240+(researchLoad-75)/75;//计算绩效
		System.out.println(name+"的绩效:"+calculation);//输出绩效
		return calculation;//返回绩效
	}		
}

public class PerformanceCalculationAdmin {
	  void allPerformanceCalculation (PerformanceCalculation[ ]  pe){
		double totalCalculation=0;//总绩效
		//计算所有成员绩效并求和
		for(int i=0;i<pe.length;i++){
			totalCalculation=totalCalculation+pe[i].doPerformanceCalculation();
		}
		System.out.printf("\n所有员工的总绩效:%3.5f\n",	totalCalculation);//输出总绩效
	}
}

public class Check {
	public static void main(String[] args) {
		//建立对象,并初始化数据,并调用功能
		Teacher p1=new Teacher("10001","王一",1,"2000.1.1","教师",2000.0,1000.0);
		p1.doTeaching();
		Teacher p2=new Teacher("10002","王二",2,"1999.2.1","教师",2200.0,800.0);
		p2.doReSearch();
		ResearchStaff p3=new ResearchStaff("10003","王三",2,"1998.3.1","科研人员",1000.0);
		p3.doReSearch();
		ResearchStaff p4=new ResearchStaff("10004","王四",1,"1997.4.1","科研人员",1200.0);
		p4.doReSearch();
		LaboratoryAssistant p5=new LaboratoryAssistant("10005","王五",1,"1998.5.1","实验员",1000.0,800.0);
		p5.doLaboratory();
		LaboratoryAssistant p6=new LaboratoryAssistant("10006","王六",2,"1996.6.1","实验员",1200.0,1000.0);
		p6.doReSearch();
		System.out.println("");
		
		PerformanceCalculation[ ]  pe=new PerformanceCalculation[6];//声明接口数组
		pe[0]=p1;    pe[1]=p2;    pe[2]=p3;    pe[3]=p4;    pe[4]=p5;    pe[5]=p6;		//接口回调
		
		PerformanceCalculationAdmin all=new PerformanceCalculationAdmin();//建立绩效管理系统类对象
		all.allPerformanceCalculation(pe);
	}
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值