jkiefer 0 Newbie Poster

OMG I need help! I have spent so much time on this. I have to make a mortgage calculator in c++ oop. WTF am I doing wrong, please help.

// Mortgage2.cpp 
//

#include "stdafx.h"
#include <iostream>
#include <math.h>
#include <string>

//#include <stdafx.h>

using namespace std;

class mortgagePayment
{
public:
    double m_principle;                           //loan amount
    double m_interest;                            //interest rate
	double m_term;				//term is 30 years
    double m_termrate[3]=
	{
		{7, 0.530};
                {15, 0.550};
		{30, 0.575};
	};
    double m_decide;
    double m_total()                                //monthly payment
    {
     if(m_interest >=1)
        m_interest = m_interest/100;
        return(m_principle * (m_interest/12))/(1-pow(1+(m_interest / 12),(m_term*-12)));
    }
};

int main()
{
    std::cout << "Please enter the total loan amount: $";
    std::cin >> m_principle;
    std::cout << "1. 7 Years at 5.35%" << std::endl;
    std::cout << "2. 15 Years at 5.5%" << std::endl;
    std::cout << "3. 30 Years at 5.75%" << std::endl;
    std::cout << "Please choose the number that corresponds to your term and interest rate: ";
	if((m_decide == 1) || (m_decide == 2) || (m_decide == 3))
		{
			break;
		}
    else
		{
			std::cout <<"*****Invalid entry, try again*****"<< std::endl;
		}
    }
    //std::cout << "You selected a term of "<<static_cast<int>(m_termrate[m_decide-1][0])<<"years and rate of "<<(m)m_termrate[m_decide-1][0]*100)<<"%"<<std::endl;
    //term = static_cast<int>(m_termrate[m_decide-1][0]);
    //interest = m_termrate[m_decide-1][1];
    std::cout << "You have entered: " << myMortgagePayment.m_term << " Years" << std::endl <<"\n";
    std::cout << "Please enter the total loan amount: $";
    std::cin >> myMortgagePayment.m_principle;
    std::cout << "You have entered: $" << myMortgagePayment.m_principle << std::endl <<"\n";
    std::cout << "Please enter the loan interest rate: ";
    std::cin >> myMortgagePayment.m_interest;
  

  
    std::cout << "Your total monthly payment is: $" << myMortgagePayment.m_total() << std::endl <<"\n" <<"\n";
    std::cout << "Thank you..." << endl;
    std::cout << endl;
    return 0;

}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.