im writing this program for an assignment and im getting errors can anyone help make some suggestions? i have to have the program print out balances for saver1 and saver2 then change the percentage rate then reprint

//header definition file for savings account
#ifndef SAVINGS_ACCOUNT_H
#define SAVINGS_ACCOUNT_H

class SavingsAccount
{
public:
	//data members
	void calculateMonthlyInterest();
	static void modifyInterestRate(double);
	void printBalance();
	double savingsBalance;

private:
	//data members
	
	static double annualInterestRate;
	
	

};
#include <iostream>
#include <iomanip>
#include "SavingsAccount.h"
using namespace std;
static double annualInterestRate;
double savingsBalance;

double SavingsAccount::annualInterestRate = 0.0;

void SavingsAccount::calculateMonthlyInterest()
{
savingsBalance += ((savingsBalance * annualInterestRate) / 12);
}

void printBalance()
{
	cout<<savingsBalance;
}
#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include "SavingsAccount.h"
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
	// Instantiate two different objects of class SavingsAccount, saver1 
// and saver2, with balances of $2000.00 and $3000.00, respectively.
	SavingsAccount saver1(2000.00);
	SavingsAccount saver2(3000.00);
	

// Set the annualInterestRate to 3%.
SavingsAccount::modifyInterestRate(3);

// Then calculate the monthly interest and print the new balances for 
// each of the savers. 
saver1.calculateMonthlyInterest();
cout<<"Saver 1 new balance is $"<<saver1.savingsBalance<<endl;
saver2.calculateMonthlyInterest();
cout<<"Saver 2 new balance is $"<<saver2.savingsBalance<<endl<<endl;

// Then set the annualInterestRate to 4%
SavingsAccount::modifyInterestRate(4);

// and calculate the next month's interest and print the new balances 
// for each of the savers

saver1.calculateMonthlyInterest();
cout<<"Saver 1 new balance is $"<<saver1.savingsBalance<<endl;
saver2.calculateMonthlyInterest();
cout<<"Saver 2 new balance is $"<<saver2.savingsBalance<<endl<<endl;
	return 0;
}

thanks in advance

Can you show the errors you receive?

On lines 11 and 12...Do you even have a valid constructor for these?

here is what i get so far
:\users\dave\desktop\itt tech\c++2\lab1\lab1\lab1.cpp(14): error C2440: 'initializing' : cannot convert from 'double' to 'SavingsAccount'
1> No constructor could take the source type, or constructor overload resolution was ambiguous
1>c:\users\dave\desktop\itt tech\c++2\lab1\lab1\lab1.cpp(15): error C2440: 'initializing' : cannot convert from 'double' to 'SavingsAccount'
1> No constructor could take the source type, or constructor overload resolution was ambiguous

Well the problem is what gerard4143 posted above you. You do not have a constructor in the SavingsAccount class that takes a double. You actually have no constructor.

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.