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

c program File Tools View Probl (35 points Amortizati Schedul Write C program th

ID: 3825540 • Letter: C

Question

c program

File Tools View Probl (35 points Amortizati Schedul Write C program that creates a loan payout schedule, The program will work for any loan with a payback time S 35 years. The interest rate is calculated daily using a daily update formula Amount owed 3Amountowed 11 x e Todays Payment lil e 271828182845905 Amount 01 is the initial loan amount. is the daily interest rate. Interest rates are usually given as an annual percentage (APR) r in the above formula is APR since there are 365.242 days per year, and APR is a percentage the decimal rate per day. t in the above formula is l, since we are updating the amount owed every day. Todays Payment is the amount paid each day.This value will be 0 for 29 days and on the 30 day this value will contain the monthly payment amount. The program wil use 3 arrays 1) Time this array shows time increments of 1/365242 years: Time 2) Amount owed As stated above, the first element contains the initial loan amount. Each consecutive element shows how the loan amount changes every day. 3) Amount,ayed This array shows the cumulative amount payed. Amount payed lil Amoun payed Todays Payment Note: The array should be long enough to hold 35 years worth of calculations Follow the flow chart on the next page to create your Cprogram. Document1 Word Notice that 1) the loop starts with I since the values of the arrays at i 0 are already set as the initial loan amount, time of0and amount paid of 0 for the arrays Amountewed, Time, Amount eyed, respectively 2) when the loop breaks, the loan is paid offcompletely. The values stored the arrays show how long it took to pay the loan, and how much money was actually paid out. Thus the algorithm can be used to estimate the effect ofadding extra money to the monthly payment schedule. Sample code execution RI: Redentered by Enter in the total loan amount: 180000 Enter in the Annual Percentage Rate (APR)% 4 Enter in the monthly payment amount 850 Total loan amount S18000000 Annual Percentage Rate (APR)is%400 Monthly payment amount $85000 After 29898 years you will owe S579.56: The total payout is S30940000 Sample code execution Enter in the total loan amount: 180000 Enter in the Annual Percentage Rate (APR)% 4 Enter in the monthly payment amount 1500 Total loan amount S180000.00 Annual Percentage Rate (APR) is 400 Monthly payment amount SI500.00 After 12.567 years you will owe 13969 The total payout is S22950000 End document PM 3/7/2017

Explanation / Answer

#include <stdio.h>
#include <math.h>
int main()
{
double amountOwed[12775], amountPayed[12775], time[12775];
double totalLoanAmount, apr, emi, todaysPayment;
for(int i = 0; i < 12775; i++)
amountOwed[i] = amountPayed[i] = time[i] = 0;
printf("Enter in the total loan amount: ");
scanf("%lf", &totalLoanAmount);
printf("Enter the Annual Percentage Rage(APR)%%: ");
scanf("%lf", &apr);
printf("Enter in the monthly payment amount: ");
scanf("%lf", &emi);
double r = apr / (100 * 365.242);
amountOwed[0] = totalLoanAmount;
int dayCounter = 1;
int i;
for(i = 1; i <= 12775 && amountOwed[i-1] > 0; i++)
{
if(dayCounter == 30)
{
todaysPayment = emi;
dayCounter = 1;
}
else
{
todaysPayment = 0;
dayCounter++;
}
time[i] = i / 365.242;
amountPayed[i] = amountPayed[i-1] + todaysPayment;
amountOwed[i] = amountOwed[i-1] * exp(r) - todaysPayment;
}
printf(" Total loan amount = $%.2f ", totalLoanAmount);
printf("Annual Percentage Rate (APR) is %.2f ", apr);
printf("Monthly payment amount = $%.2f ", emi);
printf("After years: you will owe $%.2f ", amountOwed[i-1]);
printf(" : The total payout is $%.2f ", amountPayed[i-1]);
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote