6
Answers

how to calculate cumulative interest

LOGANATHAN V

LOGANATHAN V

14y
2.9k
1
Hello.
   i am in need of to calculate following program kindly help me to do.
my project is:
for ex,
     april month deposit - 300 (int 9%)
     interest            -  2.25

     may month deposit     - 300
     existing amount(apr)  - 300
     total                 - 600 (9%)
     interest              - 4.5

sum of int (2.25+4.5) should display in text box. friends i should calculate intrest like this for 12 months
.
    my coding is:
 int cumu = Convert.ToInt32(textBox3.Text.Trim());
            int totdep = Convert.ToInt32(textBox4.Text.Trim());
            decimal tot = cumu + totdep;
            textBox4.Text = Convert.ToString(tot);
            //Decimal subyearly = Convert.ToDecimal(textBox5.Text.Trim());
            decimal cumuint = ((tot * 10) / 100)/12;

            textBox5.Text = Convert.ToString(cumuint);

actually received amount is textbox3. in textbox4 holds total received in that textbox4 calculating  interest. the interest amount will display in textbox5.
my needs are the sum of interest amount should calculate and display in textbox6    
           

how to calculate cumulative interest and the sum of interest should display textbox in c#.net back end is oracle

Thank you in advance..
Answers (6)
0
Vulpes
NA 98.3k 1.5m 14y
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
Vulpes
NA 98.3k 1.5m 14y
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
LOGANATHAN V
NA 27 17.9k 14y
thank you friend. now no problem for my coding
0
Vulpes
NA 98.3k 1.5m 14y
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
LOGANATHAN V
NA 27 17.9k 14y

Attachment book1.rar

hello friend i have attached excel book for sample calculation. kindly refer it
0
LOGANATHAN V
NA 27 17.9k 14y
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