class ColaEmployee父类

 package com.cola;

 public class ColaEmployee {
private String name;
private int bmonth; public ColaEmployee(String name,int bmonth){
this.setName(name);
this.setBmonth(bmonth);
} public String getName() {
return name;
} public void setName(String name) {
this.name = name;
} public int getBmonth() {
return bmonth;
} public void setBmonth(int bmonth) {
this.bmonth = bmonth;
} public int getSalary(int month){
if (this.getBmonth()==month) {
return ; }
else {
return ;
}
}
public void print(){
System.out.print("信息"+"姓名"+this.getName()+" 月份"+this.getBmonth());
} }

ColaEmployee

class SalariedEmployee

 package com.cola;

 public class SalariedEmployee extends ColaEmployee{
private int salary;
public SalariedEmployee(String name, int bmonth,int salary) {
super(name, bmonth);
// TODO Auto-generated constructor stub
setSalary(salary);
}
public int getSalary(int month) {
return this.salary+super.getSalary(month);
}
public void setSalary(int salary) {
this.salary = salary;
} }

SalariedEmployee

class HourlyEmployee

 package com.cola;

 public class HourlyEmployee extends ColaEmployee{
private int salary;
private int hour;
public HourlyEmployee(String name,int bmonth,int salary,int hour){
super(name, bmonth);
setSalary(salary);
setHour(hour); }
public int getSalary() {
return salary;
}
public void setSalary(int salary) {
this.salary = salary;
}
public int getHour() {
return hour;
}
public void setHour(int hour) {
this.hour = hour;
}
public int getSalary(int month) {
if(hour>){
return (int) (this.salary*+(this.hour-)*this.salary*1.5+super.getSalary(month));
} else{
return (int) (this.salary*this.hour+super.getSalary(month));
}
}
}

HourlyEmployee

class SalesEmployee

 package com.cola;

 public class SalesEmployee extends ColaEmployee{
private int sale;
private float commission;
public SalesEmployee(String name,int bmonth,int sale,float commission){
super(name,bmonth);
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) {
this.commission = commission;
} public int getSalary(int month) {
return (int)(this.sale*this.commission+super.getSalary(month));
} }

SalesEmployee

class Company

 package com.cola;

 public class Company extends ColaEmployee{

     public Company(String name, int bmonth) {
super(name, bmonth);
// TODO Auto-generated constructor stub
} public void print(){
System.out.print(this.getName()+this.getBmonth());
} }

Company

class TestEmployee

 package com.cola;

 public class TestEmployee extends ColaEmployee{
public TestEmployee(String name, int bmonth) {
super(name, bmonth);
// TODO Auto-generated constructor stub
} public static void main(String[] args) {
SalariedEmployee a=new SalariedEmployee("����",,);
a.print();
System.out.println(a.getSalary());
HourlyEmployee a1=new HourlyEmployee("����",,,);
a1.print();
System.out.println(a1.getSalary());
SalesEmployee a2=new SalesEmployee("����",,, 0.2f);
a2.print();
System.out.println(a2.getSalary()); }
}

TestEmployee

最新文章

  1. Javascript图片预加载详解
  2. Semaphore(计数信号量)
  3. jQuery事件笔记
  4. symfony2 twig模板引擎
  5. Javascript字数统计
  6. include指令和include标签的区别
  7. CSS3常用选择器(一)
  8. OpenVirteX 安装
  9. C#:WiFi
  10. HTTP协议请求方式: 中GET、POST和HEAD的介绍以及错误提示码
  11. 聊聊 Tomcat 的单机多实例
  12. 【HNOI2017】影魔
  13. C#利用Attribute实现简易AOP介绍
  14. postgres 数据库的安装
  15. #宽带选择# V2EX讨论
  16. .NET-记一次架构优化实战与方案-目录
  17. 阿里云三台CentOS7.2配置安装CDH5.12
  18. python网络爬虫笔记(三)
  19. Java 之递归遍历目录
  20. SpringBoot-整合@transactional注解

热门文章

  1. Hive进阶_Hive数据的导入
  2. jsp中c标签的使用
  3. 牛客网Java刷题知识点之什么是代码块、普通代码块、静态代码块、同步代码块、构造代码块以及执行顺序
  4. CoreDataDemo
  5. 轻量级的绘制图表js库--Morris.js
  6. css3相关样式
  7. Effective C++ 重要条款
  8. Python+selenium之测试报告(1)
  9. 轮播插件unslider.min.js使用demo
  10. wall命令