Jun 26, 2016 at 5:57pm UTC
Am having issues with the code below. No value is returned when the application is ran.Please help
#include <iostream>
#include <cmath>
using std::cout; using std::cin; using std::endl; using std::pow;
class Loan
{
protected:
double LoanAmounts;
double Yearlyinterst;
int PayOffYears;
Loan()
: LoanAmounts(0)
, Yearlyinterst(0)
, PayOffYears(0)
{
}
public:
void setLoanAmounts(double l) { LoanAmounts = l; }
void setYearlydoubleerest(double r) { Yearlyinterst = r; }
void setPayOffYears(int y) { PayOffYears = y; }
double getMonthlyDue(double term) { return (LoanAmounts * (Yearlyinterst / 12) * term) / (term - 1);}
double getTotalDue(double term) { return (getMonthlyDue(term) * PayOffYears); }
};
class MortgageCal : public Loan
{
public:
MortgageCal() : Loan(){}
};
int main()
{
MortgageCal CalFinal;
double Loan, doubleerest,term;
int Years;
cout << "Please provide Loan Amount: " << endl;
cin >> Loan;
CalFinal.setLoanAmounts(Loan);
cout << "Please provide yearly doubleerest rate: " << endl;
cin >> doubleerest;
CalFinal.setYearlydoubleerest(doubleerest);
cout << "Please provide amount of years the loan will be paid of: " << endl;
cin >> Years;
CalFinal.setPayOffYears(Years);
term= pow((1 + doubleerest / 12),( 12 * Years));
cout << "Monthly payment is " << CalFinal.getMonthlyDue(term) << endl;
}