I am in need of help to compute a present value. The user will input: payment amount (payamt), term (trm), and interest rate (intrte). I am having trouble computing the following equation:
present value = payment amount * ((1-(1+interest)^-term)/interest rate)
This is my code so far:
#include <iostream>
using namespace std;
int main()
{
int trm = 0
;
double intrte = 0.0
;
float payamt = 0.0,
presVal = 1
;
char
response = '\0'
;
cout << "Would you like to compute a present value? Enter Y for yes; N for no.";
cin >> response;
if (response != 'Y') {
return 0;
}
cout << "\nPayment Amount: $"; //payment in $ and cents for each year
cin >> payamt;
cout << "\nTerm (in years): "; //term number of years of payments
cin >> trm;
cout << "\nInterest Rate (between 0 and 100): ";//interest rate
cin >> intrte;
cout << "\n\nThe present value for a payment amount of $" << payamt
<< " and an interest rate of " << intrte
<< "%, and a term of " << trm
<< " years is $" << presVal
<< ".\n\n" << endl;
presVal == payamt * (1 - ((1 + intrte), (-trm)))/intrte;
}