Write a C program to calculate a table of loan payments like

Write a C++ program to calculate a table of loan payments like the one below. Ask the user for the minimum amount of the loan and the minimum interest rate. Output a table that has 5 loan amounts in $10000 increments and 4 interest rates in .25% increments. Use this formula to calculate each Payment, where Principle is loan amount, Rate is interest rate, and Years is length of loan (Principle*pow((1.0+(Rate/1200.0)),(Years*12.0))*(Rate/1200.0))/(pow((1.0+(Rate/1200.0)),(Years*12.0))-1.0);

Solution

#include <iostream>
#include <cmath>
using namespace std;

int main(){
    double Payment, principle, Principle, rate, Rate;
    int Years;
    cout<<\"Enter the loan amount: \";
    cin>>principle;
    cout<<\"\ Enter the interest rate: \";
    cin>>rate;
    cout<<\"\ Enter the length of loan (years): \";
    cin>>Years;
    cout<<\"\ \ TABLE OF LOAN PAYMENTS\ \ \";
    cout<<\"\\t\";
    for(int j=0; j<5; j++){
        Principle = principle + j*10000;
        cout<<Principle<<\"\\t\";
    }
    cout<<\"\ \";
    for (int i=0; i<4; i++){
        Rate = rate + i*0.25;
        cout<<Rate<<\"\\t\";
        for (int j=0; j<5; j++){
            Principle = principle + j*10000;
            Payment = (Principle*pow((1.0+(Rate/1200.0)),(Years*12.0))*(Rate/1200.0))/(pow((1.0+(Rate/1200.0)),(Years*12.0))-1.0);
            cout<<Payment<<\"\\t\";
        }
        cout<<\"\ \";
    }
}

Write a C++ program to calculate a table of loan payments like the one below. Ask the user for the minimum amount of the loan and the minimum interest rate. Out

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site