Solved

Amortization Schedule

Posted on 1997-03-19
5
335 Views
Last Modified: 2008-03-06
Write a C program that will print an amortization schedule. Your program should be interactive by requesting from the user: amount to borrow, interest rate, # of months to repay. This data should be plugged into this formula to compute monthly payment: MP=P/((1-(1+I/12)to the -M)/(I/12))

Next you should print out this information followed by a header. Then your program should go into a loop to print the schedule. The limit of the loop will be the # of months to repay. Mounthly interest should be computed with this formula: MON INT=P* (I/12)

When your schedule is finished, print out the total amount of interest paid. Consider what to do if the last payment must be changed plus or minus to make the balance go to zero.
Document each line of code
0
Comment
Question by:cstone021897
5 Comments
 
LVL 3

Expert Comment

by:pc012197
ID: 1249730
I suggest you sit down and do your homework alone...

0
 
LVL 1

Expert Comment

by:mbecker011597
ID: 1249731
agreed to pc.
0
 

Expert Comment

by:tallen
ID: 1249732
Looks like a homework problem to me.  If you can't handle this one, maybe you should change majors.
0
 
LVL 4

Expert Comment

by:emmons
ID: 1249733
Well, I did it. 37 lines of code. What is your teachers email address so that I can send it in.
0
 
LVL 4

Accepted Solution

by:
emmons earned 100 total points
ID: 1249734
void main()
{
        double MonthlyPayment; // monthly payments
        double Principal = (double)100000; // amount borrowed
        double M = (double)360; // duration of loan in months
        double AnnualInterestRate = (double)8; // annual interest rate
        double MonthlyInterestRate;     // Monthly interest rate
        double MI; // monthly interest paid
        double MonthsInAYear = (double)12; // number of months in a year
        double One = (double)1; // the multiplicative identity
        double dx, dp; // intermediate calculations
        int i; // loop counter
                   
        printf( "amount to borrow: "); scanf( "%f", &Principal);
        printf( "interest rate: "); scanf( "%f", &AnnualInterestRate);
        printf( "total months: "); scanf( "%f", &M);
       
        printf( "Borrowing $%.2f @ a rate of %.2f%% for %.0f months\n", Principal, AnnualInterestRate, M);

        MonthlyInterestRate = AnnualInterestRate / (MonthsInAYear * 100);
        dx = One + MonthlyInterestRate;
       
        for( dp = 1, i = 0; i < M; i++) dp = dp * dx;
       
        MonthlyPayment = Principal * MonthlyInterestRate / ( One - (One/dp));
        printf( "Means a monthly payment of $%.2f\n", MonthlyPayment);
       
        for( i=0; i < M; i++) {
               
                printf( "Principal $%.2f  Interest $%.2f   Balance $%.2f\n",
                        MonthlyPayment - (Principal * MonthlyInterestRate),
                        Principal * MonthlyInterestRate,
                        Principal - (MonthlyPayment - (Principal * MonthlyInterestRate)));
                Principal = Principal - (MonthlyPayment - (Principal * MonthlyInterestRate));
//                if( Principal <= MonthlyPayment) break;
        }
        printf( "Principal $%.2f  Interest $%.2f   Balance $0.00\n",
                MonthlyPayment - (Principal * MonthlyInterestRate),
                Principal * MonthlyInterestRate);

}


0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Test against App 49 138
Best UNIX-compatible free C compiler for Windows or Mac 6 268
Read file descriptor 3 in C 14 122
Passing command line arguments in C 10 100
Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question