
import java.util.*;

public class StudentArrayList2
{
   public static void main(String[] args)
   {
      ArrayList squadra = new ArrayList();
      squadra.ensureCapacity(3);

      //Student[] squadra = new Student[3];

      // fill the squadra array with Student objects

      squadra.add(new Student("Paolo Rossi", 80.,
         1999, 11, 1));
      squadra.add (new Student("Mario Bianchi", 70.,
         2000, 11, 1));
      squadra.add (new Student("Carla Verdi", 60.,
         2000, 11, 1));
      squadra.add (new Student("Stefano De Nitto", 60.,
         2004, 10, 1));
      squadra.add (new Student("Antonia Turco", 60.,
         2004, 10, 1));

      for (int i=0; i<squadra.size(); i++)
         {
			 Student e = (Student)squadra.get(i);
			 squadra.add(e);
		 }

      // print out information about all Student objects
      for (int i = 0; i < squadra.size(); i++)
      {
         Student e = (Student)squadra.get(i);
         System.out.println("name=" + e.getName()
            + ", frequency=" + e.getFrequency());
         //System.out.println();
      }
   }

}

class Student
{
   public Student(String n, double s,
      int year, int month, int day)
   {
      name = n;
      frequency = s;
      GregorianCalendar calendar
         = new GregorianCalendar(year, month - 1, day);
         // GregorianCalendar uses 0 for January
      enrollmentDay = calendar.getTime();
   }

   public String getName()
   {
      return name;
   }

   public double getFrequency()
   {
      return frequency;
   }

   public Date getEnrollmentDay()
   {
      return enrollmentDay;
   }

   public void raiseFrequency(double byPercent)
   {
      double raise = frequency * byPercent / 100;
      frequency += raise;
   }

   private String name;
   protected double frequency;
   private Date enrollmentDay;
}




