Problem

An online streaming company uses Salesforce Sales Cloud to manage customer subscriptions. They are currently seeking to automate the process of adjusting subscription end dates based on customers advance payments.


Customers can choose to pay for services in advance, and their subscription end dates need to be adjusted accordingly. Your task is to write an apex method that accepts the number of months as input and determine the subscription end date based on the current date.


Complete the given apex method to satisfy this requirement.


Instructions :


1. Accept an integer parameter representing the number of months for which the advance payment is made.


2. Find the subscription end date by adding the number of months from today's date.


2. Return the subscription end date.



Example:


//Today is 01-01-2024 (mm-dd-yyyy) and payment made for 3 months in advance

Date endDate = subscriptionController.findSubscriptionEndDate(3);

//Result
//The subscription endDate is 01-03-2024 (mm-dd-yyyy)


Hint:

Use apex date methods to find the subscription end date from today's date. To find all apex date methods, visit this article


Click here to view all apex date practice examples