Hello~
I'm working on a project in which we are suppose to create our own class seperating the class and the implementation. When i try to compile the .cpp file im getting 2 errors on line 10: 1. new types may not be defined in a return type and 2. return type specification for constructor invalid. Unfortunately i have no clue what im doing wrong here. Any help would be greatly appreciated, thx.
This is my header file, Account.h.
#include <iostream>
using namespace std;
class Account
{
public:
Account(int newAccNumber);
Account();
void setAccNumber(int newAccNumber);
void setPaymentAmount(double newPaymentAmount);
void setInterestRate(double newInterestRate);
void setPaymentsRemaining(int newPaymentsRemaining);
int getAccNumber();
double getPaymentAmount();
double getInterestRate();
int getPaymentsRemaining();
double getAmountOwed();
private:
int accNumber;
double paymentAmount;
double interestRate;
int paymentsRemaining;
double calcAmountOwed();
};
Here is my Implementation file, Account.cpp.
#include <iostream>
#include <iomanip>
#include <math.h>
#include <cstdlib>
using namespace std;
#include "Account.h"
Account::Account(int newAccNumber)
{
accNumber = newAccNumber;
}
Account::Account()
{
accNumber = 0;
paymentAmount = 0.00;
interestRate = 0.00;
paymentsRemaining = 0;
}
void Account::setAccNumber(int newAccNumber)
{
accNumber = newAccNumber;
}
void Account::setPaymentAmount (double newPaymentAmount)
{
paymentAmount = newPaymentAmount;
}
void Account::setInterestRate (double newInterestRate)
{
interestRate = newInterestRate;
}
void Account::setPaymentsRemaining (int newPaymentsRemaining)
{
paymentsRemaining = newPaymentsRemaining;
}
int Account::getAccNumber()
{
return accNumber;
}
double Account::getPaymentAmount()
{
return paymentAmount;
}
double Account::getInterestRate()
{
return interestRate;
}
int Account::getPaymentsRemaining()
{
return paymentsRemaining;
}
double Account::getAmountOwed()
{
return calcAmountOwed();
}
double Account::calcAmountOwed()
{
return paymentAmount * ( (1 - pow((1+(interestRate/12)),-interestRate*12) ) / (interestRate/12) );
}