代码拉取完成,页面将自动刷新
package ch2;
public class Manager extends Worker {
private double allowance;//津贴
private double wage;//工资
public double getAllowance(){
return allowance;}
public void setAllowance(double allowance){
this.allowance=allowance;}
public Manager(String name, double wage, double allowance) {
super(name, wage);
this.allowance=allowance;
}
public void increase(){
this.wage=this.wage+300;
this.allowance=this.allowance+200;
}
public void print(){
System.out.println(getName()+" wage:"+wage);
System.out.println(getName()+" super wage:"+super.getwage());
System.out.println(getName()+" allowance:"+allowance);
}
public static void main(String[] args){
Worker w1=new Worker("张三",2000);
w1.increase();
w1.print();
Manager w2=new Manager("李四",2000,500);
w2.increase();
w2.print();
Worker w3=new Manager("王五",2000,500);
w3.increase();
System.out.println("w3.wage="+w3.getwage());
//System.out.println("w3.allowance="+w3.getAllowance());
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。