
import java.util.*;

public class TutorTest
{

   public static void main(String[] args)
   {
      class Tutor extends Student
		  {
		     public Tutor(String n, double s,
		        int year, int month, int day)
		     {
		        super(n, s, year, month, day);
		        bonus = 0.;
		     }

		     public double getFrequency()
		     {
		        double baseFrequency = super.getFrequency();
		        return baseFrequency + bonus;
		     }

		     public void setBonus(double b)
		     {
		        bonus = b;
		     }

		     private double bonus;
		  }

      // construct a Tutor object
      Tutor expert = new Tutor("Paolo Rossi", 80.,
         1999, 11, 1);
      expert.setBonus(5);

      Student[] squadra = new Student[3];

      // fill the squadra array with Tutor and Student objects

      squadra[0] = expert;
      squadra[1] = new Student("Mario Bianchi", 70.,
         2000, 11, 1);
      squadra[2] = new Student("Carla Verdi", 60.,
         2000, 11, 1);

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

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;
}


