Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C + + : Problem 4 ( Savings Account Class ) Create a SavingsAccount class with the following specification public: SavingsAccount ( float ) ;
C: Problem Savings Account Class Create a SavingsAccount class with the following specification public: SavingsAccountfloat; Constructor void Transactionfloat; Procedure float Totalfloatint; Savings Procedure float TotalRecursivefloatint; void toString; Output Properties private: float Withdrawfloat; Utility Procedure float Depositfloat; Utility Procedure float Balance; Property int FreqWithDraw; Property int FreqDeposit; Property The constructor initilizes the balance if greater than and sets the other properties to If the transaction is greater than then a Deposit is made else a Withdraw is made. The balance is increased with a deposit but decreased if a Withdrawal. This assumes the Withdrawal is less than the balance. Cant have a negative balance. Tell the user that he is trying to make a withdrawal that exceeds his balance. When a WithDrawal is made increment FreqWithDraw else if a Deposit is made increment FreqDeposit. The toString procedure outputs all properties. The total procedure tells you how much you will have in savings given the interest rate and the amount of time. Totalfloat savint,int time returns Balancesavinttime. Utilize a for loop for this calculation. See if you can write a recursive procedure that does the same thing as Call it TotalRecursive. Think of what follows as pseudocode. The random number generator below produces a number between and If you fashion a random number that will do the same then you will get positive and negative transactions The output simply calculates the current balance with a percent interest rate and years worth of compounding. Also, you tried to start out with a negative balance which should have been initialized to Driver code SavingsAccount mine; forint i;i;i mine.Transactionfloatrandrand; mine.toString; cout"Balance after years given interest
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started