Given is the pricing plan (monthly) for products and customers would subsrcibe to the list of products.
// Atlassian pricing plans
[{
"planId": "BASIC",
"monthlyCost": "9.99"
}, {
"planId": "STANDARD",
"monthlyCost": "49.99"
}, {
"planId": "PREMIUM",
"monthlyCost": "249.99"
}]
// Customer subscription information
{
"customerId": "c1",
"product": {
"name": "Jira",
"subscription" : {
"planId": "BASIC",
"startDate": "2021-01-01" // YYYY-MM-DD format
}
}
}Create model classes and service classe(s) (CostExplorer) to expose the below two APIs:
monthlyCostList(): Array/List of size 12 filled with cost incurred in each month of the unit year
annualCost(): Total cost in a unit year
Consider the annual package from JAN - DEC.
For simplicity, let's assume we will charge the customer for the entire month even if the customer is subscribing any day after the 1st of the month.
Can someone please help me providing the logic for the two APIs required, I was not able to convince the interviewer with my answer.