I do not understand this problem can someone help me with th
Solution
Here what exactly the program want is to print the monthlyPay and also the total amount to be paid if we take under credit union or debit rate
This can be calculated easily if we know the monthlyPay and term , rebate values by using the below given formula
TotalAmonut =MonthlyPay * terms(in years) *12 +rebate
Program:
#include<iostream>
#include<math>
#include<iomanip>
using namespace std;
double getPayment(int,double,int);
int main()
{
int carPrice=0,rebate=0,term=0;
double creditRate=0.0,dealerRate=0.0,creditPayment=0.0,dealerPayment=0.0;
cout << \"car price:\";
cin >> carPrice;
cout << \"Rebate:\";
cin >> rebate;
cout << \"Credit Union rate:\";
cin >> creditRate;
cout << \"Dealer rate:\";
cin >> dealerRate;
cout << \"terms in years:\";
cin >> term;
creditPayment=getPayment(carPrice-rebate,creditRate/12,term*12);
dealerPayment=getPayment(carPrice-rebate,dealerRate/12,term*12);
cout << fixed <<-setprecision(2) << endl;
cout << \"Credit union payment: $\" << creditPayment <<endl;
cout << \"Total Pay under Credit Union is :\" << creditPayment*12*term+reabte <<endl;
cout << \"Dealer payment :$ \" << dealerPayment << endl;
cout << \"Total Pay under Dealer rate is :\" << dealerPayment*12*term+rebate <<endl;
return 0;
}
double getPayment(int prin,double monthRate,int months)
{
double monthPay=0.0;
if(1-pow(monthRate+!,-months) ==0 )
return -1;
monthPay=prin * monthRate / (1- pow(monthRate +1 ,-months));
return monthPay;
}
