Answer to Question #342803 in C++ for Sihle

Question #342803

Mr. Mohlamonyane needs to take out a loan to buy a new car. He wants an application that will allow him to enter the loan amount and the number of years he has to pay off the loan (called the term). The term can be 2 years, 3 years, 4 years, or 5 years only. The application should calculate and display his monthly car payment, using annual (per year) interest rates of 5%, 6%, 7%, 8%, 9% and 10% respectively.


1
Expert's answer
2022-05-19T08:56:32-0400
#include <iostream>

using namespace std;

int main() 
{
	float loan;
	int years;
	cout << "Please, enter the loan amount: ";
	cin >> loan;
	cout << "Please, enter the number of years to pay off the loan: ";
	cin >> years;
	if (years < 2 && years>5)
	{
		cout << "Incorrect year!";
	}
	else
	{
		cout << "Monthly car payment using annual interest rates:\n";
		cout << "5%\t6%\t7%\t8%\t9%\t10%\n";
		cout << loan / (years * 12) + loan*0.05 / 12 << "\t"
			<< loan / (years * 12) + loan*0.06 / 12 << "\t"
			<< loan / (years * 12) + loan*0.07 / 12 << "\t"
			<< loan / (years * 12) + loan*0.08 / 12 << "\t"
			<< loan / (years * 12) + loan*0.09 / 12 << "\t"
			<< loan / (years * 12) + loan*0.1 / 12;
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS