In: Computer Science
Your mortgage loan has been approved and started on a Tuesday, and you were told your first payment is due in 90 calendar days. What is the day of week of your first payment day? Write down your calculation process, the arithmetic expression you use, as well as your answer. No java coding is needed. If you only provide the answer without the other details to explain the process, you will not receive credit on this question.
Inputs
start_day : day of starting / loan approval
calendar_days : Number of calendar days in which payment is due
Output
out_day : Day of the week on which payment is due
Formula
out_day = start_day + remainder ( calendar_days / 7 )
Explanation
If we take any starting day, 7 days after the same day comes. ( There are 7 days in a week ) . So if today is Tuesday, 7 days after it will again be Tuesday. The remained of calendar days by 7 gives us how many extra days we need to account for. So if remainder is say 1, this means we are on Wednesday. The reason is that if it was Tuesday we would have a got a 0 remainder as it would have been some weeks after the starting day.
Hence, we take the remainder and out_day is the day which is remainder_days after start_day
Example
If start_day = Tuesday and calendar_days = 90
Then 90 / 7 has a remainder of 6.
( 12 * 7 = 84 )
Hence 90th day will be 6 days after Tuesday. Hence, The answer will be a Monday