0
The reason I didn't code it like that is because I don't think it's correct in principle.
When the new deposit is received, the existing deposits have accrued one month's interest. However, the new deposit won't accrue any interest until the following month when interest will be calculated on the total deposits shown in textBox4.
If, despite this, you still want to accrue interest on the new deposit as soon as it's received, then change this line:
decimal cumuint = cumu * 9m/ 1200m; // interest for a month at 9% on cumulative deposits before new one
to this one:
decimal cumuint = tot * 9m/ 1200m; // interest for a month at 9% on total deposits including the new one
Accepted 0
If I've understood it properly (which I may not have done) then try this:
int cumu = Convert.ToInt32(textBox3.Text.Trim()); // cumulative deposits before new deposit added
int dep = Convert.ToInt32(textBox4.Text.Trim()); // new monthly deposit (no interest earned yet)
decimal tot = cumu + dep; // total deposits to date
textBox4.Text = Convert.ToString(tot);
decimal cumuint = cumu * 9m/ 1200m; // interest for a month at 9% on cumulative deposits before new one
textBox5.Text = Convert.ToString(cumuint);
decimal totint = Convert.ToDecimal(textBox6.Text.Trim()); // total interest before new interest added
totint += cumuint;
textBox6.Text = Convert.ToString(totint); // total interest to date
Accepted 0
thank you friend. now no problem for my coding
0
OK, I've looked at the Excel spreadsheet and it does, as you say, calculate interest on the total deposits including the new one.
I guess that would make sense if the deposit is always paid at the beginning of each month but interest is calculated at the end of each month. So, I'd therefore incorporate the amendment in my previous post into your code.
0
hello friend i have attached excel book for sample calculation. kindly refer it
0
so far this is right. but the previous interest is 2.25 new ie second deposit interest is 4.25 so the total interest is 6.5 is should display. your coding is almost okay the sum of total int calculation is missing