title: Subclass issue (JAVA)
body: <p>I have a class <code>Appointment</code> with fields:</p>
  
  <ul>
  <li><code>int day</code></li>
  <li><code>int month</code></li>
  <li><code>int year</code></li>
  <li><code>String desc</code></li>
  </ul>
  
  <p>This stores the description of the appointment along with the date.</p>
  
  <p>Super class <code>Appointment</code>:</p>
  
  <pre><code>public class Appointment {
      int dayNum;
      int monthNum;
      int yearNum;
      String desc;
  
      public Appointment(String des, int day) {
          //Monthly Appointments (Check day)
          desc = des;
          dayNum = day;
      }
      public Appointment(String des, int day, int month){
          //Yearly Appointments (Check day AND month)   
          desc = des;
          dayNum = day;
          monthNum = month;
      }
      public Appointment(String des, int day, int month, int year){
          //One Time (Check All)
          desc = des;
          dayNum = day;
          monthNum = month;
          yearNum = year;
      }     
  }
  </code></pre>
  
  <p>Here are my 3 sub classes:</p>
  
  <p><b>A one time Appointment:</b> <code>Onetime</code> </p>
  
  <pre><code>public class OneTime extends Appointment{
      public OneTime(String des, int day, int month, int year){
          super(des, day, month, year);
      }
      public String getDesc(){
          return desc;
      }
  }
  </code></pre>
  
  <p><b>Once a month Appointments:</b> <code>Monthly</code></p>
  
  <pre><code>public class Monthly extends Appointment{
      public Monthly(String des, int monum){
          super(des, monum);
      }
      public String getDesc(){
          return desc;
      }
  }
  </code></pre>
  
  <p><b>Once a year Appointments</b> <code>Yearly</code></p>
  
  <pre><code>public class Yearly extends Appointment{
      public Yearly(String des, int day, int month){
          super(des, day, month);
      }
      public String getDesc(){
          return desc;
      }
  }
  </code></pre>
  
  <p><b>Problem:</b> I am asked to add a handful of various <code>Appointment</code> objects to an <code>ArrayList</code> (which I know). However, I must write a method <code>occursOn(int day, int month, int year)</code> that returns all appointments on that day. The part I am not sure about is writing the <code>occursOn()</code> method. Say I had an Appointment for 11/22/2018 , how would I compare a Monthly object to the day parameter / Yearly compared to the month and day parameters / <code>OneTime</code> compared to all parameters?</p>
  
  <p><b>Textbook question: </b> "  Implement a superclass <code>Appointment</code> and subclasses <code>Onetime</code>, <code>Daily</code>, and <code>Monthly</code>. An appointment has a description (for example, "see the dentist") and a date. Write a method <code>occursOn(int year, int month, int day)</code> that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill an array of <code>Appointment</code> objects with a mixture of appointments. Have the user enter a date and print out all appointments that occur on that date. "</p>
  
  <p>Note: This is not my homework. I just have a unit test on this in 2 hours and am stuck.</p>