1 Star 0 Fork 0

青菜的宝贝/升级窗口

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Manager.java 1.17 KB
一键复制 编辑 原始数据 按行查看 历史
青菜的宝贝 提交于 2021-09-18 05:38 . 工人类
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());
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/baby-of-green-vegetables/upgrade-window.git
git@gitee.com:baby-of-green-vegetables/upgrade-window.git
baby-of-green-vegetables
upgrade-window
升级窗口
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385