import java.util.*;
import java.util.GregorianCalendar;
/**
* 测试数组列表的功能
* @author Administrator
*
*/
public class TestArrayList
{
   public static void main(String[] args)
   {
       ArrayList<Employee> test=new ArrayList<Employee>();
       test.ensureCapacity(100);
       test.add(new Employee("java核心技术工程师",4000,2014,4,11));
       test.add(new Employee("java核心技术I",5000,2014,4,11));
       test.add(new Employee("java核心技术II",4000,2014,4,11));
       for(Employee e: test)//使用E去遍历存在数组中的每一个对象
       {
           System.out.println("name="+e.getName()+"\t"+"salary="+e.getSalary()+"\t"+"hireDay="+e.getHireDay());
       }
   }

}



class Employee
{
   private String name;
   private double salary;
   private Date hireDay;
   public Employee(String name,double salary,int year,int month,int day)
   {
       this.name=name;
       this.salary=salary;
       GregorianCalendar calendar=new GregorianCalendar(year,month-1,day);
       this.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=salary+raise;
   }
}