Car Payment program help needed

Need help with writing a program that calculates monthly car payments. I am supposed to be able to enter the principal amount, then based on that display the monthly car payment, length of the loan and interest rate where the interest rate will vary from 3 percent to 6 percent in increments of .5% and the length of the loan will vary from from 36 to 60 months in increments of 12 months

Output should be like the following
Interest Rate Term Monthly Payment 3.0 36 $nnn.nn
3.0 48 $nnn.nn
3.0 60 $nnn.nn
3.5 36 $nnn.nn …..
6.0 60 $nnn.nn
There should be 21 (7 * 3) combinations.

This is what I have so far. Need some help

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
void DisplayResults();
int main()
{   
	double principal=0.0, mcp=0.0;
	float interest=.03;
	int length=36;
	int count, i;

	cout<<"Enter Loan Principal: ";
	cin>>principal;
    
	//cout<<"Enter Interest Rate: ";
	//cin>>interest;
	
	//cout<<"Enter Length of Loan in Months: ";
	//cin>>length;
	for (i=0;i<=7;i++)
		interest=(interest + .005);
		for(count = 0; count <= 2; count++)
		length = length + 12;
			DisplayResults();
	system("pause");
	return 0;
}
void DisplayResults(double &principal, float &interest, int &length, double &mcp)
{
	mcp=(principal * (interest/12.0))/(1-pow((1+interest/12.0), -1*length));
	cout<<"Interest Rate percentage is: "<<interest*100<<endl;
	cout<<"Length of Loan in months is: "<<length<<endl;
	cout<<"Monthly Car Payment in dollars is: "<<mcp<<endl;
}
Topic archived. No new replies allowed.