@grow79
Just before you rewrite the whole program, a couple of friendly tips, to read the concept and understand of a C++ class again.
As I see it, you have missed some thing of understanding a class.
One, in every method of the class you are declaring a "local" variable and inputting/changing its value. Since they are not part/members of the class, you would not see them in other method of the class thus not an accurate outcome.
Two, you are chaging the values of passed-in parameters rather than using them to either copying to members or calculating some value. The calculated outcome would be passed to other method either.
Three, you have initialized a static variable outside the class as you would normally do for a static "member" of the class. The annualInterestRate is a static "local" variable to the modifyAnnualRate() method, but not of the savingsAccount class. A local static variable does not require outside the class initialization, that is for a static class member.
If I were you to start at, the starting point would look like:
1 2 3 4 5 6 7 8 9 10 11 12
|
class savingsAccount
{
private:
//here all your data members you want to use, like
double savingsBalance, annualInterestRate, interestRate;
// the members declared here accessible across the class methods
// fulfilling your purpose like, one method calculates and other prints
public:
// all your public methods like changeAnnualRate, etc
};
|
And I would avoid giving input statements in a constructor, rather, pass the required parameters and use them for member initialization in the class.
You still are not clear, then you better read a C++ reference again to have a clear understanding of it. Try it out again and come back if you need any further help.
Good luck :)