Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You are to write a program to compute the payoff time for a loan. The inputs to

ID: 3654078 • Letter: Y

Question

You are to write a program to compute the payoff time for a loan. The inputs to the program are the amount that the person will borrow, the annual percentage rate, and the amount that the person wants to pay as monthly payments. Let's suppose that the annual percentage rate is 6% and the amount to borrow is $100,000. Then the monthly interest rate will be 0.5%. After one month the interest will be 0.005 * 100000 or $500. If the person's desired monthly payment is less than the first month's interest, your program should report that the monthly payment is too low to ever pay off the loan and exit. If the desired monthly payment is larger, then your program should present a table of loan balance information: Your report should continue until the loan balance at the end of the month is 0.00. This will mean that the final payment will be equal to the principal plus the interest for the final month.

Explanation / Answer

Please rate...

Program:

=========================================================

#include<iostream>
#include<stdlib.h>
#include<iomanip>
using namespace std;
int main()
{
    cout<<"Enter the amount borrowed: ";
    double ab;
    cin>>ab;
    cout<<"Enter the annual percentage rate: ";
    double ir;
    cin>>ir;
    cout<<"Enter the monthly payment: ";
    double mpay;
    cin>>mpay;

    double mir=ir/12;
    double firstmpay=(mir*ab)/100;
    if(mpay<firstmpay)
    {
        cout<<"Your monthly payment is too low";
        exit(1);
    }

    cout<<"Month Loan Balance Start Interest Payment Loan Balance End";
    cout<<" ----- ------------------ -------- ------- ----------------";
    int m=0;
    double lbs,in,pay,lbe=ab;
    while(true)
    {
        m++;
        lbs=lbe;
        in=(mir*lbs)/100;
        pay=mpay;
        lbe=lbs+in-pay;

        if(lbe<=0)break;

        cout<<setw(5);
        cout<<" "<<m<<" ";
        cout<<setw(18);
        cout<<fixed;
        cout<<setprecision(2)<<lbs<<" ";

        cout<<setw(8);
        cout<<in<<" ";

        cout<<setw(7);
        cout<<pay<<" ";

        cout<<setw(16);
        cout<<lbe;
    }
}

=====================================================

Sample output:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote