In lot of institution they follow their official calendar year that may starts from April to next year’s March of Gregorian calendar . Each institution choose their start month and end month of their calendar year. Each calendar year should have 365 days (366 in case of leap year)
Here goes First Problem.
Financial Institutions follows April-March Calendar period. Some Academic Institutions follow June-July Period. The Problem is if Start&End months of Calendar Period for an Institution and a date is provided, To Find Calendar year’s Start Date and End Date for given date.
Sample input: Current Date = 25th December 2014
Start Month = April
End Month = March
Output: Current Calendar year’s Start Date = 1st April 2014
Current Calendar year’s End Date = 31st March 2015
Sample input: Current Date = 14th February 2015
Start Month = April
End Month = March
Output: Current Calendar year’s Start Date = 1st April 2014
Current Calendar year’s End Date = 31st March 2015
Second Problem: A person can subscribe to a Daily NewsPaper Company a range of date. The Daily News Paper Company follows the April-March Fiscal calendar. Find what are the financial years and no of days in each financial year company needs to deliver paper to the person.
for example Mr.X is subscribed to a Daily NewsPaper Company from 15th November 2014 to 26 February 2016. Then Company need to deliver newspaper for
Sample Input:Date Range: 15th November 2014 to 26 February 2016 Start&End months of a Fiscal year: April to March
Output:136 days in financial year of 1st April 2014 – 31st March 2015 331 days in financial year of 1st April 2015 – 31st March 2016
The intention is to get various points of view in Problem decomposition and solving a problem. So share your code in jsfiddle or any thing for this two Problem in what ever Programming Languages.
May be given data is redundant or insufficient !
What name would you give to the method (OR function OR procedure OR subroutine) you going to implement for these problems ? The third skill specified in this
post
I want the code with function (or what ever is in your context) returning the output for each problem not printf statement 😛
And same conditions that told for Given data is also apply for Output. i.e. redundant or insufficient.
So give it in optimal way.
Your code should be with the test code to prove your implementation is correct in all scenarios. So that any one can verify the implementation by running your code
I am eager for your replies