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

I need help getting it to be continuous. After it displays the output for the us

ID: 3818010 • Letter: I

Question

I need help getting it to be continuous. After it displays the output for the user. I want it to ask the user if he or she would like to run again,(if yes) and then make it loop back to ask the same user for another loan amount, interest and years.So the month has to start over from 1 for the second one(just like the first one. And if they choose NO, to end the program. Please help me.

I just want it to be continuous.Thank you.

I need help creating a Mortgage calculator in C programming(not C++)

My code here:

#include "stdafx.h"
#include <stdio.h>
#include <math.h>

int main(void)
{
double principle, toprinciple, principal;
double annual_rate;
double monthly_rate;
double interest_accrued;
double payment = 1;
int month = 1;
int year, n;
char myname[40] = "Jordan";
char username[40];
//title
printf("******************************************************************************** ");
printf("*******************************MORTGAGE CALCULATOR****************************** ");
printf("******************************************************************************** ");
printf(" "); //creates a blank line
printf(" ");
printf("Welcome to my Mortgage program! My name is %s. ", myname);
printf("Please enter your name. ");
scanf_s("%s", username, 40);
printf(" Enter principle amount of the loan, %s: ",username);
scanf_s("%lf", &principle);
printf(" Enter annual interest rate,%s (ex:5%%) ",username);
scanf_s("%lf", &annual_rate);
printf(" %s, Please enter the term in years (ex. 20) and press ENTER ",username);
scanf_s("%d", &year);
printf(" ");
printf(" ");
monthly_rate = annual_rate / 1200;
payment = (principle*annual_rate / 12 / 100 * (pow(1 + annual_rate / 12 / 100, year * 12) / (pow(1 + annual_rate / 12 / 100, year * 12) - 1))) + 0.01;
n = (year * 12) - 3;
printf("Principle=%.2f rate=%.2f%% %.3f ", principle, annual_rate, annual_rate / 1200);
printf("Pay/month=%.2f Years=%d %d", payment, year, year * 12);
printf(" ");
printf(" ");
printf(" Month Principle Interest $ to principle Prin Balance");
printf(" -------------------------------------------------------------------------- ");

int i = 1;

while (principle > 0)
{
principal = principle;
interest_accrued = principle * monthly_rate;
principle = principle + interest_accrued - payment;
toprinciple = payment - interest_accrued;
if ((i<4) || ((i>(year * 12 - 3)) && (i <= (year * 12))))
{
printf(" %d $%.2f $%.2f $%.2f $%.2f", month, principal, interest_accrued, toprinciple, principle);
}
month++;
i++;
}

printf(" ------------------------------------------------------------------------- ");

return 0;
}

c userstandrimaldocumentslvisual studio 2013 ProjectsAMortgage DebugMortgage.exe Welcome to my Mortgage program My name is Jordan Please enter your name Akash Enter principle amount of the loan Akash: 1000 Enter annual interest rate Akash (ex: 5 2 Akash, Please enter the term in years (ex. 20> and press ENTER Principle 1000.00 rate 32.00% 0.002 Pay month 28-65 Years 3 36 to principle Prin Balance Month Principle Interest $1000.00 $1.67 $26.99 $973.01 $973.01 $1.62 $27.03 $945.98 $945.98 $1.58 $27.08 $918.91 $85.30 $0.14 $28.51 $56.79 34 $56.79 $0.09 $28.56 $28.23 35 $28.23 $0.05 $28.61 0.37 36 Do you want to run again YN y Enter principle amount of the loan Akash: 100 nter annual interest rate, Akash (ex:5% Akash Please enter the term in years Kex 20> and press ENTER Principle -100.00 1.002 rate-2.00% Pay month 8-43 Years 1 12 to principle Prin Balance Month Principle Interest $100.00 $0.17 $8.27 $91.73 37 $91.73 $0.15 $8.28 $83.45 38 $83.45 $0.14 $8.29 $75.16 39 $25.10 $0.04 $8.39 $16.70 46 $16.70 $0.03 $8.41 $8.30 47 $8.30 $0.01 $8.42 $-0.12 48 Do you want to run again YN

Explanation / Answer

#include "stdafx.h"
#include <stdio.h>
#include <math.h>

int main(void)
{
double principle, toprinciple, principal;
double annual_rate;
double monthly_rate;
double interest_accrued;
double payment = 1;
int month = 1;
int year, n;
char myname[40] = "Jordan";
char username[40];

char ch;
//title

do

{
printf("******************************************************************************** ");
printf("*******************************MORTGAGE CALCULATOR****************************** ");
printf("******************************************************************************** ");
printf(" "); //creates a blank line
printf(" ");
printf("Welcome to my Mortgage program! My name is %s. ", myname);
printf("Please enter your name. ");
scanf_s("%s", username, 40);
printf(" Enter principle amount of the loan, %s: ",username);
scanf_s("%lf", &principle);
printf(" Enter annual interest rate,%s (ex:5%%) ",username);
scanf_s("%lf", &annual_rate);
printf(" %s, Please enter the term in years (ex. 20) and press ENTER ",username);
scanf_s("%d", &year);
printf(" ");
printf(" ");
monthly_rate = annual_rate / 1200;
payment = (principle*annual_rate / 12 / 100 * (pow(1 + annual_rate / 12 / 100, year * 12) / (pow(1 + annual_rate / 12 / 100, year * 12) - 1))) + 0.01;
n = (year * 12) - 3;
printf("Principle=%.2f rate=%.2f%% %.3f ", principle, annual_rate, annual_rate / 1200);
printf("Pay/month=%.2f Years=%d %d", payment, year, year * 12);
printf(" ");
printf(" ");
printf(" Month Principle Interest $ to principle Prin Balance");
printf(" -------------------------------------------------------------------------- ");

int i = 1;

while (principle > 0)
{
principal = principle;
interest_accrued = principle * monthly_rate;
principle = principle + interest_accrued - payment;
toprinciple = payment - interest_accrued;
if ((i<4) || ((i>(year * 12 - 3)) && (i <= (year * 12))))
{
printf(" %d $%.2f $%.2f $%.2f $%.2f", month, principal, interest_accrued, toprinciple, principle);
}
month++;
i++;
}

printf(" ------------------------------------------------------------------------- ");

month=1;
printf("Do you want to run again (Y/N)");
scanf("%c",&ch);
}while(ch!='N');

return 0;
}

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