Jun 25, 2018 at 1:32am UTC  
 
Hello, 
 
I need help to create a program with the following requirements: 
Given initial balance, rate and months to 
 
     run, how much interest accrues on a credit card? 
 
      //allow repetition to compute the interest accrues. 
 
      //compute compound credit card interest 
 
Inputs: initial balance,  
 
monthly interest rate as 
 
a decimal fraction, e.g. for 1.5% per month write 0.015 
 
month is a const of 12 months 
 
 
 Formula: 
 
Compute the accrued interest  for 12 months using a loop 
 
 interest = balance * rate; 
 
 
 
print the  
 
interest 
 
 
 
Processing : Computes interest 
 
    interest according to: 
 
      1.5% on 1st $1000 
 
      1.0% on all over $1000 
 
  Computes interest  according to 12 months 
 
 
compound credit card interest 
 
  if amount due < 1000, 
 
    interest  = balance * .015 
 
  else 
 
    interest  = balance * .01 
 
  
 
outputs: Interest due 
 
Your Test Data: 
Credit card interest 
 
Enter doubles: initial balance, monthly interest rate as 
 
a decimal fraction, e.g. for 1.5% per month write 0.015 
 
and int of 12 months the bill will run. 
 
I will give you the interest that has accumulated. 
 
1000 
 
.015 
 
12 
 
Interest accumulated = $180.00 
 
Y or y repeats, any other character quits 
 
y 
 
 
 
 
 
 
 
  Jun 25, 2018 at 1:55am UTC  
 
This looks like it'd be someone's homework.
That being said, they already told you everything you need to know. You have your equations, your inputs, your outputs, and even the methodology.
To state it simply, you need to create a function which does the math you need and returns the result.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 
float  getInterest(float  initVal, float  interestRate);
int  main()
{
    float  InterestRate = .01;
    float  CurrentBalance = 1000.0;
    int  nMonths = 12;
    for (int  x = 0; x < nMonths; x++)
        {
            CurrentBalance = CurrentBalance + getInterest(CurrentBalance, InterestRate);
        }
    return  0;
}
float  getInterest(float  initVal, float  interestRate)
{
    return  initVal*InterestRate;
}
 
Something like that, if you need to use inputs, then you'd probably be using cin and cout. You'd need to modify the equations or inputs depending on the specifics, but it's literally all there for you.
 
Last edited on Jun 25, 2018 at 1:57am UTC