(I know, it's really messy, still in the development stage)
#include <iostream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
using namespace std;
void monthsLoan(double, double);
void effectiveIntRate(double, double);
int main() {
char choice;
int const MONTHS = 12;
double payFreq; //Number of payments per year
double intRate; //Interest Rate
double effInt; //Effective interest rate
double noPay; //Number of payments
double mortgage; //Amount the mortgage is I.E. 100,000 no commas
double loanYrs; //Term of loan. I.E. 20 years 30 years
double totalMortgage; //The final amount your mortgage will cost
double formula; //(1 + (intRate/ payFreq)) The first part of the Effective Interest Rate Calculation
double formPt2;// (12/ payFreq) This is the second part of the formula for the Effective
// Interest Rate Calculation.
/***********************************************
The required formulas for producing the correct output
effInt = pow(formula, formPt2) - 1; //Effective rate formula
noPay = (MONTHS * payFreq); //Number of payments over the life of your loan
**********************************************/
system("clear");
cout << "________--------```````Mortgage Rate Calculator```````--------________"<< endl;
cout << "\n\n\t You will need to know the following information:" << endl;
cout << "1 ) The frequency of payments. (I.E. quarterly, semi-anually etc.) " << endl;
cout << "2 ) The interest rate of the loan \n\n\n\n" << endl;
cout << "Do you have those things in front of you? If so press Y" << endl;
cin >> choice;
if(choice == 'Y' || choice == 'y') {
cout << "Please enter the following information: " << endl;
cout << "Interest Rate:" << endl;
cin >> intRate;
cout << "Your number of payments per year" << endl;
cin >> payFreq;
cout << "How many years is your loan? (I.E. 30, 15)" << endl;
cin >> loanYrs;
cout << "How much is your Mortgage Loan? " << endl;
cin >> mortgage;
effectiveIntRate(intRate, payFreq);
monthsLoan(payFreq, loanYrs);
}
else {
cout << "Please grab those things and run the program again" << endl;
return (-1);
}
return 0;
}
void effectiveIntRate(double x, double y) {
double formula = (1 + (x/ y));
double formPt2 = (12/ y);
double effInt = pow(formula, formPt2) - 1;
cout << "\nThe ""Effective Interest Rate"" is: % " << effInt << endl;
}
void monthsLoan(double x, double y) {
int totalMonths = (x * y);
cout <<"Total amount of months that is in the loan:" << totalMonths << endl;
}

New Topic/Question
Reply


MultiQuote







|