I do not understand this problem can someone help me with th


I do not understand this problem can someone help me with this question and how the new program code looks like
19. In this exercise, you will modify the car payment program from Lab 9-2. If necessary, create a new project named Intermediate19 Project, and save it in the Cpp8 Chap0S folder. Copy the instructions from the Lab9-2.cpp file into a source file named Intermediate19.cpp. (Alternatively, you can enter the instructions from Figure 9-34 into the Intermediate19.cpp file.) Change the filename in the first comment. Make the modifications listed in Figure 9-39. Test the program appropriately Before calculating a monthly payment, verify that the denominator in the periodic payment formula is not the number 0. If it is 0, the function should return the number-1 (the negative number 1). 1. 2. In addition to displaying the monthly payments, the program should also display the following two amounts: The total amount the user will pay for the car if the loan is financed through the credit union. The total amount the user will pay for the car if the loan is financed through the car dealer. a. b. Figure 9-39

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;
}

 I do not understand this problem can someone help me with this question and how the new program code looks like 19. In this exercise, you will modify the car p

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site