Enhance your program from Exercise 20 by first telling the user
the minimum monthly pay...
![subject](/tpl/images/cats/informatica.png)
Computers and Technology, 11.03.2020 02:00 Jxsolvez
Enhance your program from Exercise 20 by first telling the user
the minimum monthly payment and then prompting the user to enter the monthly payment.
Your last payment might be more than the remaining loan amount and interest on it. In this case, output the actual amount of the last payment. Also, output the total interest paid.
#include
#include
using namespace std;
int main ()
{
double loanAmount;
double interestRate;
double interestRatePerMonth;
double monthlyPayment;
double paymentPrincipal;
int months;
cout << fixed << showpoint;
cout << setprecision(2);
cout << "Enter the loan amount: ";
cin >> loanAmount;
cout << endl;
cout << "Enter the interest rate per year: ";
cin >> interestRate;
cout << endl;
interestRatePerMonth = (interestRate / 100) / 12;
cout << "Enter the monthly payment: ";
cin >> monthlyPayment;
if (monthlyPayment <= loanAmount * interestRatePerMonth)
{
cout << "Monthly payment is too low. The loan cannot be repaid."
<< endl;
return 1;
}
months = 0;
while (loanAmount > 0)
{
paymentPrincipal = monthlyPayment - (loanAmount * interestRatePerMonth);
loanAmount = loanAmount - paymentPrincipal;
months++;
}
cout << "It will take " << months << " months to repay the loan."
<< endl;
return 0;
}
![ansver](/tpl/images/cats/User.png)
Answers: 2
![](/tpl/images/ask_question.png)
![](/tpl/images/ask_question_mob.png)
Another question on Computers and Technology
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 22.06.2019 07:30
Jasper and samantha are in a robotics competition. the guidelines state that the robots should be able to move a 10-gram weight at least 2 meters and turn in a circle. jasper and samantha have already built the robot. which step of the design process should they follow next to decide whether their robot meets the minimum criteria for the competition?
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 24.06.2019 00:30
Which boolean operator enables you to exclude a search term? a} not b} and c} or d} plus
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 24.06.2019 06:30
Me and category do i put them in because this is science
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 24.06.2019 17:50
Which of the following best describe how the depth-limited search works. a normal depth-first search is performed but the number of ply/depths is limited. a normal breadth-first search is performed but the number of ply/depths is limited. a normal breadth-first search is performed but values above a specific value will be ignored. a normal depth-first search is performed but values above a specific value will be ignored.
Answers: 1
You know the right answer?
Questions
![question](/tpl/images/cats/mat.png)
Mathematics, 03.12.2021 20:20
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 03.12.2021 20:20
![question](/tpl/images/cats/mat.png)
Mathematics, 03.12.2021 20:20
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 03.12.2021 20:20
![question](/tpl/images/cats/en.png)
![question](/tpl/images/cats/biologiya.png)
Biology, 03.12.2021 20:20
![question](/tpl/images/cats/en.png)
English, 03.12.2021 20:20
![question](/tpl/images/cats/en.png)
English, 03.12.2021 20:20
![question](/tpl/images/cats/geografiya.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/himiya.png)
![question](/tpl/images/cats/es.png)
Spanish, 03.12.2021 20:20
![question](/tpl/images/cats/mkx.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/en.png)
English, 03.12.2021 20:20
![question](/tpl/images/cats/fizika.png)
![question](/tpl/images/cats/obshestvoznanie.png)
Social Studies, 03.12.2021 20:20
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/health.png)
Health, 03.12.2021 20:20