第十一周作业


package lllll;
 
public class colaEmployee {
    String name;
    int month;
    int x=2000;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getMonth() {
        return month;
    }
    public void setMonth(int month) {
        this.month = month;
    }
    public colaEmployee(String name, int month) {
        super();
        this.name = name;
        this.month = month;
    }
    public  colaEmployee(){
        super();
    }
    public  void getSalary(int month){
        if(month==10)
            x+=100;
         
    }
 
}

public class hourlyEmployee extends colaEmployee {
    private int hourlysalary;
    private int hourlytime;
 
    public hourlyEmployee() {
        super();
    }
 
    public hourlyEmployee(String name, int month,int hourlytime,int hourlysalary) {
        super(name, month);
        this.hourlytime=hourlytime;
        this.hourlysalary=hourlysalary;
    }
 
    public double getHourlysalary(int month) {
         if (super.month == month) {
                if (hourlytime > 160) {
                    return hourlysalary * 160 + hourlysalary * (hourlytime - 160) * 1.5 + 100;
                } else {
                    return hourlysalary * hourlytime + 100;
                }
            } else {
                if (hourlytime > 160) {
                    return hourlysalary * 160 + hourlysalary * (hourlytime - 160) * 1.5;
                } else {
                    return hourlysalary * hourlytime;
                }
            }
 
        }
 
 
}
package hellowhomework;
 
public class SalariedEmployee extends ColaEmployee{
    int monthmoney;
    public void gudingSalar(String name,int month,int birthday,    int monthmoney) {
        if(month==birthday) {
            System.out.println(name+"工资为"+(monthmoney+100));
            }else {
                System.out.println(name+"工资为"+monthmoney);
            }
     
    }
}
 

 

 

 

posted @ 2020-05-19 18:13  -Sehnsucht  阅读(104)  评论(0编辑  收藏  举报