Age Calculator


Calculate a person’s age at a given date.
Do this by creating a single public method that takes a person’s birth date and a target date to compare to and returns their age as an integer.

Examples

Zenith was born on 28 October 2016 how old was she on 5 November 2022? Answer 6.

Bonus

In the age of Social Media birthday, weeks are a big deal. To allow for this, add a new method to the Calculator that returns the start date of the person’s birthday week, as a string, according to the following rules.

  • If my birthday is Thursday-Saturday, my birthday week starts on the Sunday of that week. E.g. If I was born on September 9, 2017, my birthday week will start on September 3, 2017.
  • If my birthday is Sunday-Wednesday, my birthday week starts 6 days back. E.g. If I was born on September 3, 2017, my birthday week will start on August 28, 2017.