Loan and amortization table.. how!?

Please help me. I thought this would be easy and then I started and WOAH.. I don't know.. I think I'm just confusing myself more... He wants the following:

Print a welcome message.
Loop until the user wants to leave the program.
- an input section which asks for some information including amount of the loan, the number of payments (in terms of months), and the annual interest rate.
- Table: For example, given the amount of the loan is 10000, the annual interest rate is 8% and the number of payments is 12, a table similar to the following will be generated
 ``123456`` ``````Month Paid Principal Paid Interest New Balance 1 803.22 66.67 9196.78 2 808.57 61.31 8388.21 3 813.96 55.92 7574.25 .. ....... ...... ...... 12 864.12 5.76 -0.00``````

etc you don't know how many months user will input...

-an output section to print out other results such as monthly interest rate, monthly payment, accumulated interest payment over the loan period, and total payment, along with the input parameters.

 ``12345678`` ``````Customer: John Doe loan amount: 10000.00 annual interest rate: 8.00% number of payments: 12 monthly interest: 0.6667% accumulated interest : 438.61 monthly payment : 869.89 total payment : 10438.61``````

So, I don't think the second table.. with customer name will be difficult but I got stuck after asking all the input.. I blanked out. How would I make it specific for each month?? I'm a beginner so please don't be mean.. I'm trying! :/ Heres what I have so far.. I might be completely wrong.. I haven't read up on the other loops and only know the while loop right now.. but if another loop is needed let me know so I can read up on it...

 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134`` ``````********************************************************************/ #include //For input/output streams #include //For math used in program #include //Output manipulator #include //Used for output file #include //Use with strings using namespace std; int main() { //Variable identifiers string firstName, lastName; //User information int month; //Month int payments; //Number of payments char answer; //Answer quit/start double loanAmount; //Loan amount double anIntRate; //Yealy interest Rate double monIntRate; //Monthly interest rate double monthPayment; //Monthly payment double balance; //Balance due double monthPrinciple; //Monthly principle paid double monthPaidInt; //Month interest paid cout<<" River Bank " <>answer; //If letter s is chosen if (answer == 's') { cout<<"Okay.. we will first need some basic" <<" information about you and your loan.\n\n"; //Ask user for first name cout<<"What is your first name?"<>firstName; //Ask user for last name cout<<"What is your last name?"<>lastName; //Ask user for the loan amount cout<<"What is the full amount of your loan?"<>loanAmount; //Ask user for the interest rate cout<<"What is the annual interest rate on your loan?"<>anIntRate; //Ask user for the amount of payments cout<<"How many payments do you want to make" <<" to pay this loan off? Please answer" <<" me with the number of months."<>payments; //Calculations //Monthly interest rate monIntRate = ((anIntRate/100)/12); //Monthly payment monthPayment = (loanAmount * monIntRate * (pow(1+monIntRate, payments) /(pow (1+monIntRate, payments)-1))); //Amount paid to interest each month monthPaidInt = balance * monIntRate; //Amount paid to principle monthPrinciple = monthPayment-monthPaidInt; //New balance due balance = balance - monthPrinciple; month=1; cout< "; cin>>answer; //reuse the answer variable if (answer != 'y' && answer != 'Y') { //stop if the choice is not 'y' or 'Y' cout<<"Thank you for visiting River Bank's" <<" electronic loan amortization calculator" <<". Have a wonderful day and come visit us" <<" again soon for all your banking needs."<

FYI: When you get your doubles, you can't put in values like "8.00%", you will either have to divide by 100.0 yourself or tell them to input a value like 0.08.

I would probably just create a for loop (you can read up on that if you want), that increments until you get to the numbers of months they specified, calculating the interest/payments etc the way you are currently (although I haven't actually checked your formulas). You will probably need a variable like "temp_principal" that stores the new principal for calculation of interest etc.
Topic archived. No new replies allowed.