Final answer:
To compute the next month's savings based on whether the month is odd or even in the ComputeSavings() function, you need to add an if statement inside the else block. If the month is odd, add 18 to the current month's savings. If the month is even, add 6 to the current month's savings.
Step-by-step explanation:
To complete the recursive case of the ComputeSavings() function, we need to add an if statement inside the else block. If the month is odd, we call ComputeSavings() recursively and compute the next month's savings as the current month's savings plus 18. If the month is even, we call ComputeSavings() recursively and compute the next month's savings as the current month's savings plus 6.
else {
if (month % 2 == 1) {
ComputeSavings(totalMonth, month + 1, savings + 18);
}
else {
ComputeSavings(totalMonth, month + 1, savings + 6);
}
}