000
13.08.2007, 10:37 Uhr
~NICK
Gast
|
What I want you to do is write a program that will track a loan amount over time as interest is added to the loan and repayments are made. Start by asking the user to enter an annual percentage interest rate, an initial loan amount and the amount of monthly repayments they will make. When you have this information calculate the amount of interest for that month, add it to the total and then subtract the monthly repayment for that month. Continue the calculations until the loan amount is at zero dollars (or below). This should be a relatively easy task and there may even be code on the system that will deal with this - look around for it, though you may have to change it a bit. When you have done this, I want you to use the setprecision, setw and fixed manipulators defined in the <iomanip> header to control the formatting of numbers. Add some lines of output to your program to print out a table formatted like the following: Month Balance Interest Payment 1 $ 10050.00 $ 100.50 $ 500.00 2 $ 9650.50 $ 96.51 $ 500.00 3 $ 9247.01 $ 92.47 $ 500.00 4 $ 8839.48 $ 88.39 $ 500.00 Use setw to set each column width, and use fixed and setprecision to properly show dollars and cents. |