c216519
2015-01-22 03:43
采纳率: 100%
浏览 2.8k
已采纳

java 新手问题关于Employee的

import java.util.*;

public class EmployeeTest
{
public static void main(String[] args)
{ Employee[] staff= new Employee[3];

        staff[0]=new Employee("cch",75000,1992,3,21);
        staff[1]=new Employee("csh",50000,1992,2,19);
        staff[2]=new Employee("ctt",50000,1992,2,21);

        for(Employee e : staff)
            e.raiseSalary(5);

        for(Employee e : staff)
            System.out.printlm("name="+e.getName()+",salary="+e.getSalary+",hireDay="+e.getHireDay());
       }

}
class Employee
{
public Employee(String n,double s,int year,int month,int day)
{
name=n;
salary=s;
GregorianCalendar calendar=new GregorianCalendar(year,month-1,day);
hireDay=calendar.getTime();
}

   public String getName()
   {
       return name;
    }
    public double getSalary()
    {
       return salary;
    }
     public Date getHireDay()
     {
       return hireDay;
     }

     public void raiseSalary(double byPercent)
     {
        double raise=salary*byPercent/100;
        salary+=raise;
     }

     private String name;
     private double salary;
     private Date hireDay;

}
编译时说是 e.getSalary找不到符号

2条回答 默认 最新

相关推荐 更多相似问题