hi everyone...I need help on solving this question...
Create a SavingAccount class. Use a static data member to contain the annualInterestRate for each of the saver.
Each member of the class contains a private data member savingsBalance indicating the amount the saver currently has on
deposit. Provide a calculateMonthlyInterest member function that calculates the monthly interest by multiplying
the balance by annualInterestRate divided by 12; this interest should be added to savingsBalance.
Provide a static member function modifyInterestRate that sets the static annualInterestRate to a new value.
Write a driver program to test class savingsAccount. Instantiate two different savingsAccount objects, saver1 and saver2,
with balances of $2000.00 and $3000.00, respectively. Set annualInterestRate to 3% then calculate the monthly interest
and print the new balances for each of the savers. Then set the annualInterestRate to 4% and calculate the
next month’s interest and print the new balances for the saver. Your out put should able to display as below:

Output monthly balances for one year at .03
Balances : Saver 1 $2000.00 Saver 2 $3000.00
Month 1: Saver 1 $2005.00 Saver 2 $3007.50
Month 2: Saver 1 $2010.01 Saver 2 $3015.02
Month 3: Saver 1 $2015.04 Saver 2 $3022.56
Month 4: Saver 1 $2020.08 Saver 2 $3030.11
Month 5: Saver 1 $2025.13 Saver 2 $3037.69
Month 6: Saver 1 $2030.19 Saver 2 $3045.28
Month 7: Saver 1 $2035.26 Saver 2 $3052.90
Month 8: Saver 1 $2040.35 Saver 2 $3060.53
Month 9: Saver 1 $2045.45 Saver 2 $3068.18
Month 10: Saver 1 $2050.57 Saver 2 $3075.85
Month 11: Saver 1 $2055.69 Saver 2 $3083.54
Month 12: Saver 1 $2060.83 Saver 2 $3091.25
After setting interest rate to .04
Balances : Saver 1 $2067.70 Saver 2 $3101.55

Urgent!any help and direction will be appreaciated

Recommended Answers

All 8 Replies

Ok, here's some help

class SavingAccount
{
// put class objects and methods here

}

i also knw..but i wan to c the full program ma...

i also knw..but i wan to c the full program ma...

I think Ancient Dragon was trying to say that he won't do everything for you because it's your homework and not his. If you do some of it yourself then I think the guys here will be more willing to help you.

commented: Yes indeed! +9

Here is the program Try to enjoy the OOP !!!!!!!!!!!
Try to Modify as your expectation........... ;)

/* Example Program for the Bank Account*/

#include <iostream>
using namespace std;

class SavingsAccount
{
	public:
		SavingsAccount(){}
		SavingsAccount(int value);
		~SavingsAccount(){}
		static float annualInterestRate;
		void calculateMonthlyInterest();
		static void modifyIntererestRate(float value);
		float GetBalance() const { return savingsBalance; }
	private:
		// Each member of the class contains a private data member 
		// savingsBalance indicating the amount the saver currently has 
		// on deposit.
		float savingsBalance;
};

// copy constructor to initialize the value at instantiation
SavingsAccount::SavingsAccount(int value)
{
	savingsBalance = value;
}

// Use a static data member annualInterestRate to store the annual interest
// rate for each of the savers. 
float SavingsAccount::annualInterestRate = 0;

// Provide member function calculateMonthlyInterest that calculates the 
// monthly interest by multiplying the savingsBalance by annualInterestRate
// divided by 12 and then adds this interest to savingsBalance.
void SavingsAccount::calculateMonthlyInterest()
{
	savingsBalance += ((savingsBalance * annualInterestRate) / 12);
}

//Provide a static member function modifyIntererestRate that sets the 
// static annualInterestRate to a new value. 
void SavingsAccount::modifyIntererestRate(float value)
{
	annualInterestRate = value;
}

int main()
{
	// 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::modifyIntererestRate(3);

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

	cout << endl;

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

	// and calculate the next month's interest and print the new balances 
	// for each of the savers
	saver1.calculateMonthlyInterest();
	cout << "Saver 1 Savings Balance: $" << saver1.GetBalance() << endl;
	saver2.calculateMonthlyInterest();
	cout << "Saver 2 Savings Balance: $" << saver2.GetBalance() << endl;

	cout << endl;
	return 0;
}
commented: Post about 4 years old but entire program written out for OP. May not really help anyone except future students with the same hw problem. +0

hi everyone...I need help on writing a pseudocode for this question...
Create a SavingAccount class. Use a static data member to contain the annualInterestRate for each of the saver.
Each member of the class contains a private data member savingsBalance indicating the amount the saver currently has on
deposit. Provide a calculateMonthlyInterest member function that calculates the monthly interest by multiplying
the balance by annualInterestRate divided by 12; this interest should be added to savingsBalance.
Provide a static member function modifyInterestRate that sets the static annualInterestRate to a new value.
Write a driver program to test class savingsAccount. Instantiate two different savingsAccount objects, saver1 and saver2,
with balances of $2000.00 and $3000.00, respectively. Set annualInterestRate to 3% then calculate the monthly interest
and print the new balances for each of the savers. Then set the annualInterestRate to 4% and calculate the
next month’s interest and print the new balances for the saver. Your out put should able to display as below:

commented: Think about what you did here. Very Vogon of you to bury a request in such an old discussion. +15

Well done. You posted exactly the same question as the first post in this old thread. I guess you didn't read the complete discussion, or the complete solution in the last post. Then you asked for "help" without saying what help you needed.

People here wil help you, but you have to put in some efort and thought yourself.

Start a new topic for your discussion. Post what you have dome so far. Explain exactly what help youqare seeking. The brief spells out the code almost line by line, so it's not clear why you are having difficulty.

yes,it is important to review the topics which gave knowledge contribution

you should use the "system" function in a loop, then it works properly

commented: Nonsense reply to long-dead topic -3
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.