Hello I am having some problem, can any body give me a helping hand
each time I compile I get this error massage, I dont know where I made the mistake help please I new to programming
This is my Main File
include libraries
#include <iostream> //Call C++ normal imput and output library
#include <fstream> //Standard Library C++ class with constructors, a destructor and overloaded operators.
#include <windows.h> //Standard Windows Operations Library
#include <cmath> //Standard Library Mathematical Operations
#include <iomanip> //Standard Formatting Operations
#include "M_Calculator.h" // Call for information from mortage payment file
using namespace std;
//function prototypes
void Assignment();
void Loop(MortgageCal&);
void MenuDisplay();
void Display(double, double, double, int);
bool Exit();
void ClearScreen();
//Main function and assignment function
void main()
{
Assignment();
}
void Assignment()
{
//variables to be assinged by the user
double principle, interest, balance; //Assinged principle
int term;
int answer;
int const SIZE = 3;
//Starting of arrays
int t[] = { 7, 15, 30 }; //Assinged term
double i[SIZE]; //Assinged interest
ifstream fin;
fin.open("InterestCal.txt"); //Call external Interest file
for (int j = 0; j < SIZE; j++)
{
fin>>i[j];
}
//Screen display and user to input values
cout << endl;
cout << "\n"; //Add space on screen
cout <<"\t"<< " *************************************************************" << endl;
cout <<"\t\t\t"<< "------- Title Of Program-------- "<< endl; // Display Title for the program
cout <<"\t\t"<<" C++ Object-oriented Calculates Mortgage Program Week 4 "<< endl;
cout <<"\t\t\t\t"<<"Created by Carl Cargill "<< endl; // Display Author of the program
cout <<"\t"<< " *************************************************************" << endl;
cout << "\n";
cout <<"\t"<<"Here is your Caclulator, Fellow instuction to get the right results "<< endl;
cout << "\n";
cout<<"\t Please Enter Your Mortage amount you want: $ ";
cin>>principle;
MenuDisplay();
cin>>answer; //holds the answer to user input based from menu display
switch(answer)
{
case 1 : interest = i[0];
term = t[0];
break;
case 2 : interest = i[1];
term = t[1];
break;
case 3 : interest = i[2];
term = t[2];
break;
default : cout<<"\tPlease fellow instruction and enter (1), (2) or (3)"<<std::endl;
Assignment();
break;
}
MortgageCal UseMort(principle,interest,balance,term); //create an instance of Mortgage Calculator vie the overloaded constructor
Loop(UseMort); //callign Loop function passing in a reference of Amortisation
}
void Loop(MortgageCal &UseMort) //the loop function references an instance of Mortgage Calculation
{
double principle;
int months;
principle = UseMort.GetPrinciple();
months = UseMort.GetTerm() * 12; //convert the term into total months
int i, j = 1; //counters
for(i = 1; i < months; i++) //the start of our loop using the total number of months as our counter
{
principle -= UseMort.GetMonthlyPayment(); //change principle to relflect payment
UseMort.SetPrinciple(principle); //update the principle member variable to the new principle
Display(UseMort.GetMonthlyPayment(), UseMort.GetMonthlyInterestPaid(), UseMort.GetBalanceOwed(),i);
//Pause programe on every 12th month
if(j == 12)
{
system("PAUSE");
j = 1;
}
else
j++;
}
//validate if the user want to input new data, and reacts to any response from the user
if(Exit() != true)
{
UseMort.~MortgageCal();
}
else
{
UseMort.~MortgageCal();
ClearScreen();
Assignment();
}
}
//Print out Menu Display on screen for user to make selection
void MenuDisplay()
{
cout << "\n";
cout<<"\tHere is your Interest Menu choices below:"<<std::endl;
cout << "\n";
cout<<"\tSelect a choice below by entering (1), (2) or (3) on your keyboard"<<std::endl;
cout << "\n";
cout<<"\t(1) 7 year term at 5.35% interest"<<std::endl;
cout<<"\t(2) 15 year term at 5.5% interest"<<std::endl;
cout<<"\t(3) 30 year term at 5.75% interest"<<std::endl;
}
//Display function, after use selection will display result
void Display(double monthlyPay, double interestPay, double balanceOwed, int month)
{
cout<<"\tMonth\tPayment \tInterest"<<std::endl;
cout<<"\t-----\t------- \t-------- \t--------"<<std::endl;
cout<<"\t"<< fixed << showpoint << setprecision(2)<<month<<"\t"<<monthlyPay<<" \t"<<interestPay<<" \t"<<balanceOwed<<std::endl;
cout << "\n";
cout << "\n";
}
//Exit function, and question the user on there way forward
bool Exit()
{
char exit = 'i';
cout<<"\n\nTo carry out a next calclulation or end program (y = yes or n = no) : ";
cin>>exit;
if(exit != 'y' && exit != 'n') //check to make sure input is what its suppose to be
{
cout<<"\n Please fellow instruction you must enter (y = yes or n = no)."<<std::endl;
Exit();
}
if(exit == 'y')
return true;
else
return false;
}
//Clear Screen function, retives buffer and count rows & colum to clear and start back at 0,0 co0rdinate
void ClearScreen()
{
HANDLE StdOut = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO Buflnf;
COORD Origin = {0,0};
DWORD LenWrt;
GetConsoleScreenBufferInfo(StdOut, &Buflnf); //Get screen rows and columns
int ChrCnt = Buflnf.dwSize.X * Buflnf.dwSize.Y;
FillConsoleOutputAttribute(StdOut, Buflnf.wAttributes, ChrCnt, Origin, &LenWrt);
FillConsoleOutputCharacter(StdOut,' ', ChrCnt, Origin, &LenWrt);
SetConsoleCursorPosition(StdOut, Origin);
}
This is my Header file
class MortgageCal
{
private:
//variables
double cal_principle; //initial value of the loan amount
double cal_interest; //initial interest towards the loan
double cal_balance;
int cal_terms; //initial term length of loan (years)
public:
//constuctor is over loaded
MortgageCal(); //default constuctor
MortgageCal(double,double,double,int); //over loaded constuctor takes 4 paramaters
//default destructor
~MortgageCal() {}
//Set inline methods
void SetPrinciple(double p) { cal_principle = p; }
void SetInterest(double i) { cal_interest = i; }
void Setbalance(double b) { cal_balance = b; }
void SetTerm(int t) { cal_terms = t; }
//Get the inline methods and All methods are constants to ensure no data is changed
const double GetPrinciple() const { return cal_principle; }
const double GetInterest() const { return cal_interest; }
const double GetBalanceOwed() const { return cal_balance; }
const int GetTerm() const { return cal_terms; }
//another go getter function methods
const double GetMonthlyPayment() const;
const double GetMonthlyInterestPaid() const;
const double GetMonthlyBalanceOwed() const;
};
//Variable constructor and Initialize predetermined values
MortgageCal::MortgageCal() :
cal_principle(),
cal_interest(),
cal_balance(),
cal_terms()
{
}
//Overloaded constructor which initialize member variables based on parameter values (principle, interest, term)
MortgageCal::MortgageCal(double p, double i, double b, int t) :
cal_principle(p),
cal_interest(i),
cal_balance(b),
cal_terms(t)
{
}
//Get Monthly Payment Method,and working out of payment and return
const double MortgageCal::GetMonthlyPayment() const
{
//calculating the montly payment and return monthly amount
double mnthPayment;
mnthPayment = (cal_principle * (cal_interest/12)) / (1.0 -pow(1.0/(1.0+(cal_interest/12)),12 * cal_terms));
return mnthPayment;
}
//Get Monthly Interest Paid Method and Calculates the monthly interest paid and returns
const double MortgageCal::GetMonthlyInterestPaid() const
{
double interestPaid;
//calculating the interest paid and return interest paid
interestPaid = (cal_principle * (cal_interest/12));
return interestPaid;
}
//Get Monthly Balance owed Method and and working out of Balance and return
const double MortgageCal::GetMonthlyBalanceOwed() const
{
double balanceOwed;
//calculating the Balance Owed and return Balance Owed
balanceOwed = (cal_principle - (cal_principle/12));
return balanceOwed;
}
This is my Text File
0.0535
0.055
0.0575