文件名称:HardWork
介绍说明--下载内容来自于网络,使用问题请自行百度
上转型对象
1.实验目的
掌握上转型对象的使用。
2. 实验要求
要求有一个abstract类,类名为Employee,Employee的子类有YearWorker、MonthWorker和WeekWorker。YearWorker对象按年领取薪水,MonthWorker按月领取薪水,WeekWorker按周领取薪水。Employee有一个abstract方法:
public abstract earnings()
子类必须重写父类的earnings()方法,给出各自领取薪水的具体方式。
有一个Company类,该类用Employee数组作为成员,Employee数组的单元可以是YearWorker对象、MonthWorker对象或WeekWorker对象的上转型对象。程序能输出Company对象一年需支付的薪水总额。
-The transformation of the object 1. Purpose of the experiment used to grasp the transformation of the object. 2. Experiment requires a abstract class requirements, class named Employee, Employee of the child class has YearWorker, MonthWorker and WeekWorker. YearWorker object to receive annual salary, MonthWorker receive a monthly salary, WeekWorker receive weekly salary. Employee one abstract method: public abstract earnings () sub-class must override the parent class of earnings () method, given their own specific way of receiving pay. A Company class, such as members with an array of Employee, Employee of the array elements can be YearWorker object, MonthWorker object or objects on the transformation of objects WeekWorker. Company object program can output a year' s salary to be paid the total amount.
1.实验目的
掌握上转型对象的使用。
2. 实验要求
要求有一个abstract类,类名为Employee,Employee的子类有YearWorker、MonthWorker和WeekWorker。YearWorker对象按年领取薪水,MonthWorker按月领取薪水,WeekWorker按周领取薪水。Employee有一个abstract方法:
public abstract earnings()
子类必须重写父类的earnings()方法,给出各自领取薪水的具体方式。
有一个Company类,该类用Employee数组作为成员,Employee数组的单元可以是YearWorker对象、MonthWorker对象或WeekWorker对象的上转型对象。程序能输出Company对象一年需支付的薪水总额。
-The transformation of the object 1. Purpose of the experiment used to grasp the transformation of the object. 2. Experiment requires a abstract class requirements, class named Employee, Employee of the child class has YearWorker, MonthWorker and WeekWorker. YearWorker object to receive annual salary, MonthWorker receive a monthly salary, WeekWorker receive weekly salary. Employee one abstract method: public abstract earnings () sub-class must override the parent class of earnings () method, given their own specific way of receiving pay. A Company class, such as members with an array of Employee, Employee of the array elements can be YearWorker object, MonthWorker object or objects on the transformation of objects WeekWorker. Company object program can output a year' s salary to be paid the total amount.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
HardWork.doc
HardWork.java
HardWork.java
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.