实现一个名为Person的类和它的子类Employee, Manager是Employee的子类,设计一个接口Add用于涨工资,普通

如题所述

第1个回答  2013-10-27
package Ex5_1; public class Person {
public String name,address,telephone;
public Person(String name, String address, String telephone) { this.name = name; this.address = address;
this.telephone = telephone; }
public String getName() {
return name; }
public String getAddress() { return address;

}
public String getTelephone() { return telephone;
} }
package Ex5_1;
public class Employee extends Person { private String office; private double wage;
public Employee(String name, String address, String telephone,String office,double wage) {
super(name, address, telephone); this.office=office;
this.wage=wage; }
public String getOffice() {
return office;
}
public double getWage() {
return wage; } }
package Ex5_1; public class Demo {
public static void main(String[] args) {
Employee a=new Employee("cui","shanghai","1234567","505b",0); System.out.println(a.getName()); System.out.println(a.getAddress());
System.out.println(a.getTelephone()); System.out.println(a.getOffice()); System.out.println(a.getWage());
} }