可能关于格式问题,我找不出错误
程序代码:
import java.util.Calendar; public class Object { public interface AddtionalSalary { public abstract int getAddtionalSalary (); } public class Employee { String EmpName;//员工姓名 int Month;//员工生日月份 public int getAddtionalSalary (){ return 0;//待 } void setMonth(int Month){ this.Month=Month; } int getMonth(){ return Month; } public int getSalary (int Month){ Calendar ca = Calendar.getInstance(); int MonthNow = ca.get(Calendar.MONTH); this.Month = Month; // 实现生日加工资 100 int salaryBir=0; if(Month==MonthNow) salaryBir += 100; else salaryBir = 0; return salaryBir; } } class SalariedEmployee extends Employee{ int MonthlyPay; } class HourlyEmployee extends Employee{ int HourlyPay; int HourTime; } class SalesEmployee extends Employee { int Saleroom; int SalesPercentage; } class BasePlusSalesEmployee extends SalesEmployee { int BaseSalary; } public static void main(String[] args) { // TODO Auto-generated method stub Employee Em = new Employee(); Em.setMonth(10); System.out.println(getMonth()); } }
最后的调用System.out.println(getMonth());一直说没创建getMonth类,还没学精,请指点一二,谢谢