#pragma once
class Account
{
public:
//default constructors
Account();
//constructor
Account(double newSavingsBalance);
//Methods
//double MonthlyInterestRate();
//double newBalance();
void getMonthlyInterestRate();
static double AnnualInterestRate();
static void ModifyInterestRate(double newAnnualInterestRate);
void setSavingsBalance(double newSavingsBalance);
double getSavingsBalance();
double getAnnualInterestRate();
public:
~Account(void);
private:
double SavingsBalance;
//static double AnnualInterestRate;
};
#include "StdAfx.h"
#include "Account.h"
Account::Account(void)
{
}
Account::Account(double newSavingsBalance)
{
setSavingsBalance(newSavingsBalance);
}
Account::~Account(void)
{
}
void Account::getMonthlyInterestRate()
{
setSavingsBalance(getSavingsBalance() + (getSavingsBalance() * (AnnualInterestRate / 12)));
}
//gets the current balance in account
double Account::getSavingsBalance()
{
return SavingsBalance;
}
void Account::setSavingsBalance(double newSavingsBalance)
{
SavingsBalance = newSavingsBalance;
}
void Account::ModifyInterestRate(double newAnnualInterestRate)
{
AnnualInterestRate = newAnnualInterestRate;
}
// SavingsAccount.cpp : main project file.
#include "stdafx.h"
#include "Account.h"
#include <iostream>
using namespace System;
using namespace std;
int main(array<System::String ^> ^args)
{
Account Eddie(2000.00);
Account Amy(3000.00);
Eddie.ModifyInterestRate(0.03);
Eddie.getMonthlyInterestRate();
Amy.getMonthlyInterestRate();
cout<<Eddie.getSavingsBalance()<<endl;
return 0;
}
Before I commented out the private: static double AnnualInterestRate I was getting a link error - unresolved token private static double Account::AnnualInterestRate
so I made it public and I got the same error.