Hi i have to create a SavingsAccount class. Use a static data members to contain the annualIntrestRate for each of the server. each member of class contains a private data member savingBalance includin the amount the saver currently has on deposit. provide a calculateMonthlyIntrest member function that calculates the monthly intrest by multiplying the balance by annualIntrestRate divided bye 12; this intrest should be added to savingBalance. provide a static data member function modifyIntrestRate that sets the static annualIntrestRate to a new value. write a driver program to test class SavingsAccounts. Instantiate two diffrent savingBalance objects, saver1 and saver2, with balance of $2000.00 and $3000.00, respectively. set annualIntrestRate to 3%, then calculate the monthly intrest and print the new balance for each of the saver. then set the annualIntrestRate to 4% and calculate the new month intrest and print the new balances for each of the saver.
here is so for what i got all i need is to help me what should i put in main
this is the header file
Code://HEADER FILE OF SAVING ACCOUNTS #ifndef SAVINGACCOUNT_H #define SAVINGACCOUNT_H class SavingsAccount { public: // static void modifyInterestrate(float interest); SavingsAccount(float); ~SavingsAccount(); float calculateMonthlIntrest(); float getSavingBalance()const; static void modifyInterestrate(float); private: float savingBalance; static float annualInterstRate; }; #endif this is the savingAccount.cpp #include <iostream.h> #include "SavingAccount.h" float SavingsAccount::annualInterstRate =0.0; SavingsAccount::SavingsAccount(float balance) { savingBalance = balance; } SavingsAccount::~SavingsAccount() { cout<<"Destructor"<<endl; } float SavingsAccount::calculateMonthlIntrest() { return savingBalance * annualInterstRate / 12.0f; } float SavingsAccount::getSavingBalance()const { return savingBalance; } void SavingsAccount::modifyInterestrate(float interest) { annualInterstRate = interest; } and In main i need help what should i put int main() SavingsAccount saver1, saver2 // what comes up next in main



LinkBack URL
About LinkBacks


