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

c programming Write a C program that creates a loan payout schedule. The program

ID: 3825440 • Letter: C

Question

c programming

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 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 30^th 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] = i/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_ payed: This array shows the cumulative amount payed. Amount_ payed[i] = Amount_ payed [i - 1] + TodaysPayment

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.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote