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

Please help..due at midnight and haven\'t fully gotten arrays down... Write a C

ID: 3825129 • Letter: P

Question

Please help..due at midnight and haven't fully gotten arrays down...

Write a C program that creates a loan payout schedule. The program will work for any loan with a payback time lessthanorequalto 35 years. The interest rate is calculated daily using a daily update formula Amount_ owed [i] = Amount_ owed [I - 1] times e^rt - TodaysPayment e = 2.71828182845905 owed. Amount_ owed [0] is the initial loan amount r is the daily interest rate. Interest rates are usually given as an annual percentage rate (APR). r in the above formula is r = APR/100 times 365.242' since there are 365.242 days per year, and APR is a percentage, r is the decimal rate per day. t in the above formula is 1, since we are updating the amount owed every day. TodaysPayment is the amount paid each day. This value will be 0 for 29 days and on the 30th day this value will contain the monthly payment amount. The program will use 3 arrays: Time: this array shows time increments of 1/365.242 years Time [i] = 1/365.242 Amount_ owed: As stated above, the first element contains the initial loan amount. Each consecutive element shows how the loan amount changes every day. Amount_ payment: This array shows the cumulative amount payed. Amount_ payed [i] = Amount_ payed [I - 1] + TodaysPayment

Explanation / Answer

#include <iostream.h>
#include <math.h>
#include <iomanip.h>

int main (void)

{

//Declare Variables

double principal, rate, mrate, mpay, factor, interest, balance;
int month, cnt;

//Program Title

cout << endl;
cout << "Loan Amortization Program ";
cout << endl;

//Input from User

cout << "What is the value of the loan? ";
cin >> principal;

cout << "What is the loan duration (in months)? ";
cin >> month;

cout << "What is the APR (Annual Percentage Rate)? ";
cin >> rate;

cout << endl;

//Calculation of Monthly Payment

mrate = (rate/1200);
factor = pow( (mrate+1), (month));
factor = (factor-1);
mpay = (mrate+(mrate/factor))*principal;

//Display Output to User

cout << "Loan Amortization Information: ";
cout << endl;

cout << "Intial Loan Value: $" << principal << " ";
cout << "Loan Duration: " << month << " months ";
cout << "Annual Percentage Rate: " << rate <<"% ";
cout << "Monthly Payment: $" << mpay << " ";


//Up to this point, everything works and is formatted correctly.

//Loop for Displaying Payment Information

cout << setw(5) << "Month" << setw(5) << "Starting Balance" <<
"Interest" << "Payment" << "New Balance" << endl;

cout << endl;

cnt = 1;
while (cnt <= (month-1))
{
setprecision(2);
interest = ((principal*(rate/100))/month);
cout << cnt << " " << principal << " " << interest << " " <<
mpay << " " << (principal = ((principal+interest)-mpay)) << endl;

cnt++;

}

interest = ((principal*(rate/100))/month);
cout << setprecision(2);
cout << month << " " << principal << " " << interest << " " << mpay <<
" " << (principal+interest) << " " << ((principal+interest)-mpay) <<
endl;


cout << endl;
return 0;

}