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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main ()
{
double Payment, MonthlyInterestRate, NumberOfPayments, LoanAmount, ListPriceOfCar;
double DownPayment, AnnualInterestRate, PriceOfCar, SalesTax, SalesTaxRate, TotalPaidForCar,k;
double MonthlyPayment, MonthlyPayment2, MonthlyPayment3, MonthlyPayment4, MonthlyPayment5, MonthlyPayment6, NumberOfMonths, InterestPaid, years;
ListPriceOfCar = 10000;
DownPayment = 1000;
AnnualInterestRate = 0.03;
SalesTaxRate = 0.0625;
MonthlyInterestRate = AnnualInterestRate / 12;
PriceOfCar = ListPriceOfCar - DownPayment;
SalesTax = PriceOfCar * SalesTaxRate;
LoanAmount = PriceOfCar + SalesTax;
TotalPaidForCar = MonthlyPayment * NumberOfMonths;
InterestPaid = TotalPaidForCar - LoanAmount;
NumberOfMonths = (12,24,36,48,60,72);
MonthlyPayment = (ListPriceOfCar * pow(MonthlyInterestRate + 1, 12) * MonthlyInterestRate) / (pow(MonthlyInterestRate + 1, 12) - 1);
MonthlyPayment2 =(ListPriceOfCar * pow(MonthlyInterestRate + 1, 24) * MonthlyInterestRate) / (pow(MonthlyInterestRate + 1, 24) - 1);
MonthlyPayment3 =(ListPriceOfCar * pow(MonthlyInterestRate + 1, 36) * MonthlyInterestRate) / (pow(MonthlyInterestRate + 1, 36) - 1);
MonthlyPayment4 =(ListPriceOfCar * pow(MonthlyInterestRate + 1, 48) * MonthlyInterestRate) / (pow(MonthlyInterestRate + 1, 48) - 1);
MonthlyPayment5 =(ListPriceOfCar * pow(MonthlyInterestRate + 1, 60) * MonthlyInterestRate) / (pow(MonthlyInterestRate + 1, 60) - 1);
MonthlyPayment6 =(ListPriceOfCar * pow(MonthlyInterestRate + 1, 72) * MonthlyInterestRate) / (pow(MonthlyInterestRate + 1, 72) - 1);
cout << "The list price of the car $";
cin >> ListPriceOfCar;
cout << "The Down payment $";
cin >> DownPayment;
cout <<"The Annual Interest Rate $";
cin >> AnnualInterestRate;
cout << endl;
cout << endl;
cout << "List Price Of Car - " << ListPriceOfCar << endl;
cout << endl;
cout << "Down Payment - " << DownPayment << endl;
cout << endl;
cout << "Sales Tax - " << SalesTax << endl;
cout << endl;
cout << "Loan Amount - " << LoanAmount << endl;
cout << endl;
cout << "Interest Rate - " << AnnualInterestRate << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout <<"Loan Term"<<setw(10)<<"12"<<setw(10)<<"24"<<setw(10)<<"36"<<setw(10)<<"48"<<setw(10)<<"60"<<setw(10)<<"72"<<endl<<endl;
cout <<"Payment"<<setw(15)<<MonthlyPayment<<setw(10)<<MonthlyPayment2<<setw(10)<<MonthlyPayment3<<setw(10)<<MonthlyPayment4<<setw(10)<<MonthlyPayment5<<setw(10)<<MonthlyPayment6<<endl;
cout <<"Total Paid"<<setw(15)<<TotalPaidForCar;
cout <<"Interest paid"<<setw(15)<<
system ("PAUSE");
return 0;
}
| |