Problem

An insurance company utilizes Salesforce to manage customer and policy details and seeks to determine whether a policy is within the waiting period for any claims, which is set at 90 days.

Complete the provided apex method to find if the given date (policy start date) falls within the last 90 days.

Instructions

  • The Apex method must accept a date as input, the policy start date.
  • Determine if the date falls within the last 90 days.
  • Return true if the date falls within the last 90 days; otherwise, return false.

Sample output

Date input = Date.newInstance(2021, 5, 15);

Integer result = policyContoller.isWithin90Days(Date inputDate);

//Given today's date is 06-16-2021 (mm-dd-yyyy)

//Result is true

Note : This exercise introduces you to writing a simple apex method to check if the given date is within the last 90 days. Focus on meeting the requirements, and feel free to validate your code using the execute button.

To learn more about date methods in apex, visit the official documentation here.