0

Hello everyone. I am pretty lost when it comes to C++, but for class i have to create this mortgage calculator. I think i have this part of the assignment done, but i can not figure out how to convert either the last number, or the user input to a percentage.

So any help would be great!! Thanks everyone!

```
/*
Write the program as a procedural C++ program. Calculate
and display the mortgage payment amount using the amount
of the mortgage, the term of the mortgage, and the interest
rate of the mortgage as input by the user. Allow the user to
loop back and enter new data or quit. Insert comments in the
program to document the program.
*/
#include <iostream>
#include <cmath>
using namespace std;
int main () {
double principle = 200000;
double interest = .00575;
int term = 30 * 12;
double total;
double monthlyInterest = interest * 12;
total = (principle * monthlyInterest)/(1-pow(1 + monthlyInterest, -term));
cout << "Enter Loan Amount: " <<endl;
cin >> principle;
if (principle <= 0){
cout << "Enter valid input: ";
cin >> principle;
}
cout << "Enter desired Interest Rate: " << endl;
cin >> interest;
if (interest <= 0) {
cout << "Please enter a valid Interest Rate";
cin >> interest;
}
cout << "Your priniple is " << principle << endl;
cout << "Your Interste rate is: " << interest << endl;
cout << "Term Length: " << term << " Months" << endl;
cout << "Your total monthly payment is: " << total << endl;
return 0;
}
```