代码如下,为什么会出现在。java的文件中申明错误,请大神指点下,谢谢!
public class Demo_Employee {
public static void main(String[] args)
{
Manager m = new Manager("张三","9547",2000);
m.work();
m.Bonus("50000");
System.out.println(m.getName()+"...."+m.getId()+"...."+m.getSalary());
Coder c = new Coder("","9875",5000);
c.work();
System.out.println(c.getName()+"...."+c.getId()+"...."+c.getSalary());
}
}
/*
雇员类
工资 salary 姓名 name 工号 id
*/
public abstract class Employee
{
private String name;
private String id;
private double salary;
public Employee(){}
public Employee(String name,String id,double salary){
this.name = name;
this.id = id;
this.salary = salary;
}
public void setName(String name){
this.name = name;
}
public String getName(){
return name;
}
public void setId(String id){
this.id = id;
}
public String getId(){
this.id = id;
}
public void setSalary(double salary){
this.salary = salary;
}
public double getSalary(){
return salary;
}
public abstract void work();
}
/*
manager类
工作为管理
*/
public class Manager extends Employee{
private String bonus;
public Manager(){}
public Manager(String name,String id,double salary){
super(name,id,salary);
}
public void work(){
System.out.println("我的名字是:"+getName()+",我的工号是:"+getId()+",我的工资是:"+getSalary());
}
//public void Bonus(){}
public String Bonus(){
this.bonus = bonus;
}
public void setBonus(String bonus){
this.bonus = bonus;
}
public String getBonus(){
return bonus;
}
public void Bonus(String bonus){
System.out.println("奖金");
}
}
/*
coder类
工作为写代码
*/
public class Coder extends Employee{
public Coder(){}
public Coder(String name,String id,double salary){
super(name,id,salary);
}
public void work(){
System.out.println("我的名字是:"+getName()+",我的工号是:"+getId()+",我的工资是:"+getSalary());
}
}请大神指点下,谢谢
|
|