Question: Please help with first year computer science question (OOP, 2D array etc) Question 3. (8 points) Given the following Birthday class, you will see that
Please help with first year computer science question (OOP, 2D array etc)

Question 3. (8 points) Given the following Birthday class, you will see that it has the day, month, and year of birth as attributes. This class also has various methods, such as a constructor that initializes these attributes, and an accessor method for each attribute public class Birthday // attributes private int day; private int month; private int year; // constructor public Birthday( int dd, int mm, int yy ') day = dd; month mm year yy: // accessors public int getDayreturn day; 1 public int getMonth) 1 return month; h public int getYear) 1 return year; h For this question, you are asked to add a method called compareToAnother to this class that takes a Birthday object as input and returns an integer number as output. The purpose of this method is to compare itself to the input birthday object and see which birthday occurs earlier. In particular, the method will return an integer output as follows Return 0 if this birthday and the input object occur on the same date Return 1 if this birthdate occurs earlier than the input object birthdate Return-1 if this birthdate occurs later than the input object birthdate Grading scheme: [2 pts] Method header [1 pt] Logic works when both birthdays are the same [1 pt] Logic works when input birthday is earlier [1 pt] Logic works when input birthday is later [1 pt] Correct return value [1 pt] Use of accessor methods as needed [l pt] Overall syntax
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
