public class Employee{
private String name;
private double salary;
private int dep_number;
public Employee(String n,double s){
name=n;
salary=s;
}
public void setDep_num(int dep_num){
dep_number=dep_num;
}
public int getDep_num(){
return dep_number;
}
public void setSalary(double s){
salary=s;
}
public void raiseSalary(double by_percent){
salary *=(1+by_percent);
}
public double getSalary(){
return salary;
}
}
class Manager extends Employee{
private String secretaryName;
private int dep_num;
public Manager(String n,double s,int dep_num){
super (n,s);
this.dep_num=dep_num;
}
public void setSecretaryName(String name){
secretaryName=name;
}
public String getSecretaryName(){
return secretaryName;
}
}
class ManagerTest{
public static void main(String args[]){
Manager man=new Manager("Annie",41000,2);
man.setSecretaryName("Mariee");
man.raiseSalary(0.01);
System.out.println("The manager's secretary is "+man.getSecretaryName());
System.out.println("The manager' ralary is "+man.getSalary());
}
}
class ManagerWithOverWriTest{
public static void main(String args[]){
ManagerWithOverWri man=new ManagerWithOverWri("Annie",41000,2);
man.setSecretary("Mariee");
man.raiseSalary(0.05);
System.out.println("The manager'secretary is "+man.getSecretaryName());
System.out.println("The manager' salary is "+man.getSalary());
}
}
这段红色的代码有什么问题呀!?我真的看不出来!书上说这是要重写Manager类,可是我就是不知道为什么老是错了!老是有下面的这段话!
--------------------配置: <默认>--------------------
C:\Java文件夹\Employee.java:52: 找不到符号
符号: 类 ManagerWithOverWri
位置: 类 ManagerWithOverWriTest
ManagerWithOverWri man=new ManagerWithOverWri("Annie",41000,2);
^
C:\Java文件夹\Employee.java:52: 找不到符号
符号: 类 ManagerWithOverWri
位置: 类 ManagerWithOverWriTest
ManagerWithOverWri man=new ManagerWithOverWri("Annie",41000,2);
^
2 错误
处理已完成。
超郁闷……麻烦大家帮帮我!