Car Payment Calculator with Values in code.//Monthly Payment on New car
#include <cstdlib>
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
int num1;
int num2;
double num3;
int num4;
int num5;
double num6;
double num7;
float math;
math = pow(1+0.00541666666/12,-60);
float math2;
math2 = pow(0.00541666666,60);
//Down Payment
num1 = 2200;
//Car Price
num2 = 22000;
//Monthly interest rate
num3 = 0.00541666666;
//Number of Months all together
num4 = 60;
// Year
num5 = 12;
// APR
num6 = 6.5;
// First part of the Equation
num7 = 107.25;
cout << "Prices on my new car!" << endl;
cout << "Purchase Price= "<< num2 << endl;
cout << "Yearly APR= %"<< num6 << endl;
cout << "Monthly Interest= "<< num6 / num5 << endl;
cout << "Interest* (purchase-Downpayment)= "<< num3 * (num2 - num1)<< endl;
/* cout<< "Monthly carpayment= " << num3 * (num2 - num1) * ( math/ math -1); */
cout << "Monthly Payment= "<< (num2)*(num3/12)/(1-math) << endl;
system("PAUSE");
return 0;
}
Car Payment Calculator with Values being Input.
#include <cstdlib>
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
string name;
float price, dpmt, apr, pmt, years, months;
cout << "Hello!\n";
cout << "What is your name?";
cin >> name;
cout << "Hello, " << name << ", let me calculate your payments.\n\n" ;
cout << "What is the sales price? ";
cin >> price;
cout << endl;
cout << "What is the down payment? ";
cin >> dpmt;
cout << endl;
cout << "What is the APR? ";
cin >> apr;
cout << endl;
cout << "How many years will you finance for? ";
cin >> years;
cout << endl;
apr = apr / 100 / 12;
months = years * 12;
pmt = (apr * (price - dpmt)) * ((pow((1 + apr), months))
/(pow((1+ apr), months)-1));
cout << "Your monthly payment will be $" << pmt << endl << endl;
cout <<"Have a good day, "<< name <<" , thanks for putting me to work!" <<endl;
cout << endl;
system("PAUSE");
return 0;
}