954,492 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Newbie needs help with mortgage program

I've been taking an accelerated C++ program for 3 weeks now...my current assignment is to write a program that, with user input of a mortgage loan amount, the term of the loan, and the interest rate, display the monthly payment. Then list the loan balance and interest paid for each payment over the term of the loan without letting the list scroll off the screen. Allow user to continue viewing list, enter new data, or quit. My program is a mess (don't laugh, the monthly payment portion of the program worked last week). No compile errors, but the calculations are way wrong and the list doesn't stop scrolling. Any help would be greatly appreciated. :-)

Attached is the source file; I'm using Dev- as the compiler.

Attachments Week_4_Mortgage_(d).cpp (2.99KB)
niteowl44
Newbie Poster
3 posts since Apr 2005
Reputation Points: 10
Solved Threads: 0
 
No compile errors, but the calculations are way wrong

How should the calculations work? what's the formula for calculating it?and the list doesn't stop scrolling.
There is no break within the for loop, you do have a while loop after it, but it doesn't seem(with your formatting and lack thereof) it is ever going to be used within your printing..

Have you learned about functions yet? You should probably make the while loop into a function and call it to check for screen breaks.

marinme
Junior Poster in Training
63 posts since Apr 2005
Reputation Points: 10
Solved Threads: 1
 

The calculations should show the loan balance and interest paid after each monthly payment. The formulas are:

LoanBalance=Initial Loan Amount - MonthlyPrincipalPaid
Then, the loop should have the same loan balance formula, followed by:
MonthlyInterestPaid=LoanBalance * InterestRate

I'm not sure if these formulas are right.

I'm just beginning to learn about functions, so I will have to do some reading in order to set up the while loop as a function.

How should the calculations work? what's the formula for calculating it?

There is no break within the for loop, you do have a while loop after it, but it doesn't seem(with your formatting and lack thereof) it is ever going to be used within your printing..

Have you learned about functions yet? You should probably make the while loop into a function and call it to check for screen breaks.

niteowl44
Newbie Poster
3 posts since Apr 2005
Reputation Points: 10
Solved Threads: 0
 

Well, after getting a lot of help, I have a working program. I also have a much better understanding of loops now. The source code file is attached.

The calculations should show the loan balance and interest paid after each monthly payment. The formulas are:

LoanBalance=Initial Loan Amount - MonthlyPrincipalPaid Then, the loop should have the same loan balance formula, followed by: MonthlyInterestPaid=LoanBalance * InterestRate

I'm not sure if these formulas are right.

I'm just beginning to learn about functions, so I will have to do some reading in order to set up the while loop as a function.

Attachments Week_4_Mortgage_(j).cpp (3.59KB)
niteowl44
Newbie Poster
3 posts since Apr 2005
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You