This program should be an interactive program .C++ only You program should do th
ID: 3664485 • Letter: T
Question
This program should be an interactive program.C++ only
You program should do the following:
Display a Welcome title for the Loan Calculator
Prompt the user to enter the price of the car
Prompt the user to enter the length of the term in months
Prompt the user to enter the APR in percentage (e.g. 4.79%) - without the percent sign of course
Your program should then report with the monthly payment will be.
Use setw() and setfill() to display the content like a receipt. All the data should be neatly displayed.
Example
For a Friend Loan Calculator
Price of Vehicle: $25,000
Term of Loan (in months): 60
APR in percentage (e.g. 4.79% - without the percent sign): 3.8
--------------------------------------------------------------
Total Monthly Payments: $433.50 //NOT ACCURATE
Display all money totals (output values) to two decimal places. You should output an accurate result as well.
For extra credit you may factor in a state auto sales tax of 6.5% of the purchase price of the vehicle and how much of a down payment the user would like to put down. Of course, if you are factor down payment, you must prompt the user to enter that amount.
Explanation / Answer
#include <iostream>
#include <cmath>
#include <ctime>
#include <cstdlib>
using namespace std;
int num1,
num2,
response,
answer1,
ran1,
x;
int main()
{
cout << "Welcome to my Interactive Loan Calculator"<<endl;
cout <<"By My name"<<endl;
cout <<"This program will input basic information about your loan"<<endl;
cout <<"It will output what your monthly payment will be"<<endl;
cout <<endl;
float loanamount;
float interestrate;
float monthlypayment;
cout <<"What is the amount of the loan?$";
cin >>loanamount; cin.ignore();
cout << What is the interest rate on the loan?$";
cin >>interestrate;interestrate/=100;cin.ignore();
cout <<"What is the desired monthly payment?$";
cin >>monthlypayment:cin.ignore();
while(monthlypayment<loanamount*interestrate/12){
cout <<"Not a valid payment amount. Amount must be greater than$";
cout <<(loanamount*interestrate/12)<<endl;
cout <<"What is the desired monthly payment amount?$";
cin >>monthlypayment:cin.ignore();
}
float totalpaid=0.0f;
float interesttoadd=0.0f;
int nmonths=0;
float remaining=loanamount;
float toadd=0.0f;
cout <<"Month# Interest /added, Amount Paid, Debt Remaining"<<endl;
while(remaining>0)
{
interesttoadd=remaining*interestrate/12;
nmonths++;
remaining+=interesttoadd;
if(remaining>monthlypayment){
toadd=monthlypayment;
{
}
else
toadd=remaining;
}
cout<<nmonths<<":$"<<interesttoadd<<":$"<<toadd
<<":$"<<remaining<<endl;
totalpaid+=toadd;
remaining-=toadd;
}
cout <<endl<<"Statistics aout loan."<<endl;
cout <<"Initial loan amount:$"<<loanamount<<endl;
cout <<"Total amount paid:$"<<totalpaid<<endl;
cout <<"Time to pay off loan:"<<nmonths<<endl;
cout <<"Overpay percentage:"<<(totalpaid/loanamount)<<endl;
cout <<"Press enter to exit program..."<<endl0;
cin.ignore();
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.