any idea what i am doing wrong?
Error 3 error LNK2001: unresolved external symbol "private: static float SavingsAccount::annualInterestRate" (?annualInterestRate@SavingsAccount@@0MA) Savings.obj
SavingsAccount.h
#ifndef SAVINGSACCOUNT1_H
#define SAVINGSACCOUNT1_H
using namespace std;
class SavingsAccount
{
private:
static float annualInterestRate;
float savingsBalance;
public:
SavingsAccount()
{
annualInterestRate = 0.03;
savingsBalance= 2000;
}
float calculateMonthlyInterest()
{
float subtotal = 0;
float monthlyint = 0;
subtotal = savingsBalance * annualInterestRate;
monthlyint = subtotal / 12;
savingsBalance = monthlyint + savingsBalance;
return savingsBalance;
}
static void modifyInterestRate()
{
annualInterestRate=.04;
}
void printSavingsBalance()
{
cout << "Your balance is: $" << savingsBalance << endl;
}
};
#endif
Savings.cpp
#include <iostream>
#include "SavingsAccount.h"
using namespace std;
int main()
{
SavingsAccount saver1; //instantiate saver1;
SavingsAccount saver2; //instantiate saver2;
saver1.printSavingsBalance();
cout << "Interest of Month #1" << saver1.calculateMonthlyInterest() << endl;
saver1.modifyInterestRate();
cout << "Interest of Month #2" << saver1.calculateMonthlyInterest() << endl;
return 0;
}
any help would be great
:o