十一周java作业

public class fff {


        String name;
        int month;

        public Jhd() {

        }

        public Jhd(String name, int month) {
            super();
            this.name = name;
            this.month = month;
        }

        public double getSalary(int month) {
            return 0;
    }

}
public class FFF
private int hourlysalary;
        private int hourlytime;

        public Ntd() {
            super();
        }

        public Ntd(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;
                    }
                }
    }

}
public class Kbf extends fff
public class fff {


         public static void main(String[] args) {
                // TODO Auto-generated method stub
                 Jhd[] all = {
                            new Hgc("田某", 5, 9000),//name,month,月薪
                            new Ntd("马某", 5, 10, 30),//name,month,时薪,小时数
                            new Kbf("田某某", 3, 50000, 0.3)//name,month,月销售额,提成率
                            };
                    for (int i = 0; i < all.length; i++) {
                        new Bja().getSalary(all[i],5);
                    }
    }

}

 

 {


          private int monthSales;// 月销售额
            private double royaltyRate;// 提成率
         
            public Kbf(String name, int month, int monthSales, double royaltyRate) {
                super(name, month);
                this.monthSales = monthSales;
                this.royaltyRate = royaltyRate;
            }
         
            public double getSalary(int month) {
                if (super.month == month) {
                    return monthSales * royaltyRate + 100;
                } else {
                    return monthSales * royaltyRate;
                }
    }

}
public class fff {

        public void getSalary(Jhd c,int month) {
            System.out.println(c.name + "在" + month + "月的月薪为" + c.getSalary(month)+"元");
    }

}

 

 extends fff {


           double salary;
            public Hgc() {
                super();
            }
            public Hgc(String name, int month,int salary) {
                super(name,month);
                this.salary = salary;
            }
            public double getSalary(int month) {
                if (super.month == month) {
                    return salary + 100;
                }else {
                    return salary;
                }
    }

}

 

posted @ 2020-05-20 09:35  啪啪怪  阅读(183)  评论(0编辑  收藏  举报