# Develop a Loan Calculator to calculate and display a list of monthly payments for a loan.

Develop a Loan Calculator to calculate and display a list of monthly payments for a loan.

The user will be asked to enter the loan amount and the number of payments.  The program will calculate the monthly payment for APR ranging from 3% to 10% with an increment of 0.25%.  Hence, the APR will be 3%, 3.25%, 3.5%, 3.75%, 4%, 4.25%, 4.5%, 4.75%, 5%, ............. 10%.

I dont know how to do this exercise i have done a loan calulater as seen below but it dont know how to use it with this exercise. Please some one help me

#include <iostream>
#include <cmath>
using namespace std;
int main()
{
// Function propotype for the pow function is:   double pow(double, double)

double  payment, loan, apr, temp;
int     term;

cout << "Please enter the loan amount (no \$ or comma): ";
cin >> loan;
cout << "Please enter the interest rate (no % sign): ";
cin >> apr;
cout << "Please enter the number of payments: ";
cin >> term;

temp = pow((1.0 + apr/1200.0), (double) term);
payment = loan * (apr/1200.0) * temp / (temp - 1.0);
cout << "The monthly payment is: " << payment << endl;

return 0;
} // main
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Author Commented:
0
Author Commented:
the output is supposed to look like this
Shown below is a sample output for a loan of \$225,000 with 360 payments.

Loan: \$225,000     # of payments: 360
APR    Monthly Payment
3%          \$948.609
3.25%     \$979.214
3.5%       \$1010.35
3.75%     \$1042.01
4%          \$1074.18
.
.
.
.
.
9.75%      \$1933.1
10%         \$1974.54
the code above is too complicated and too long. I dont think that this code is supposed to be very long.
0
Author Commented:
im not sure where im supposed to start does this exercize involve creating a loop because i dont really understand how to create loops
0
Data Warehouse Architect / DBACommented:
Ok,

It's actually pretty easy, once you get the hang of it.  :)

Your program uses cout to display prompts and cin to read in the values.  According to this assignment you will need to do that for the amount and term, but you are told what interest rates to apply.

After accepting the two values from the user, a loop around the calculations (and display of the results) should do the trick.

Since you know the starting and ending interest rates, and the increment is constant, the *for* loop is the most appropriate.  Since you're new to loops, it will look like this:

for (rate = 3.0; rate <= 10; rate = rate + 0.25)

That should just about do it for you.  :)

Good Luck,
Kent
0
Author Commented:
0
Author Commented:
quick question do i only define the rate as 3.0 and leave the other variables as they are
0
Data Warehouse Architect / DBACommented:
declare rate as a float (or double) as you already have.

C will take care of the rest.  The *for* loop that I suggested actually works like this:

rate = 3.0;
while (rate <= 10)
{
rate = rate + 0.25;
}

Using *for* is just a shorter way to write the loop than using the *while* syntax.

Kent
0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Author Commented:
ok got that part wehen i try to run the program my result do not apear in the way that the outcome is supposed to look like i just get  all the numbers one after the other and i think that the program that i wrote doesnt really help with this exercise its just confusing me more than anything
0
Author Commented:
i need some help with the cosmetics of my program it does what its supposed to but i need help making it look like the output above is supposed to. all of my stuff comes out looking jumbled up
0
Author Commented:
thank you so much you were very helpful
0
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.