Äߧý∩†H♠H䎀
Fully Optimized
- Messages
- 3,629
Okay I have a problem that I'm trying to figure out and its probably really simple and I'm just misunderstanding it. I've got a scenario that I've got to write some code for and I'm kind of stuck.
Scenario
A analyst wants a report to tally retirement benefits. It should show 5 values for each client. The report assumes the client has invested $5,000 a year for 5,10,15,20 and 25 years and earn a rate of 10% annually.
I've got the main module setup which has a houseKeeping(), mainLoop() and finishUP() modules. I've also completed the houseKeeping() calling the files and reading the records.
The mainLoop() module is what I'm having problems with. The mainLoop() calls the headings() then needs to be looped 5 times until the last year (25) has been exceeded with an increment of 5.
So I know I need to assign a value of (5) to the counter and exceed it. How exactly should I write the code for this? Within this loop it also wants me to call the calcSavings() which will do the calculations for the invest totals through the 5 different years listed above. I need it to initialize a counter and an accumulator before entering a loop, then loop the module 5 times. The loop needs to calculate the return on investment while adding the investment per year and increment the counter. It then prints the years and totals.
Anyone decent with code that could help me out here?
Scenario
A analyst wants a report to tally retirement benefits. It should show 5 values for each client. The report assumes the client has invested $5,000 a year for 5,10,15,20 and 25 years and earn a rate of 10% annually.
I've got the main module setup which has a houseKeeping(), mainLoop() and finishUP() modules. I've also completed the houseKeeping() calling the files and reading the records.
The mainLoop() module is what I'm having problems with. The mainLoop() calls the headings() then needs to be looped 5 times until the last year (25) has been exceeded with an increment of 5.
So I know I need to assign a value of (5) to the counter and exceed it. How exactly should I write the code for this? Within this loop it also wants me to call the calcSavings() which will do the calculations for the invest totals through the 5 different years listed above. I need it to initialize a counter and an accumulator before entering a loop, then loop the module 5 times. The loop needs to calculate the return on investment while adding the investment per year and increment the counter. It then prints the years and totals.
Anyone decent with code that could help me out here?