Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that calculates the balance of a savings account at the end of a three- month period. It shoud ask the user for

image text in transcribedimage text in transcribedimage text in transcribed

Write a program that calculates the balance of a savings account at the end of a three- month period. It shoud ask the user for the starting balance and the annual interest rate. A loop should then iterate once for every month in the period, performing the following steps A) Ask the u and add it to the balance. Do not accept negative numbers B) Ask the user for the total amount withdrawn from the account during that month and subtract it from the balance. Do not accept negative numbers or numbers greater than the balance after the deposits for the month have been added in. C] Calculate the interest for that month. The monthly interest rate is the annual ser for the total amount deposited into the account during that month interest rate divided by 12. Multiply the monthly interest rate by the average of that month's starting and ending balance to get the interest amount for the month. This amount should be added to the balance After the last teration, the program should display a report that includes the following information starting balance at the beginning of the three-month period total deposits made during the three months total withdrawals made during the three months total interest posted to the account during the three months final balanc Test Casel: Welcome to Your Bank! What is your starting Balance? $100 What is the annual interest rate. Please enter whole value. For example 6 for 6% :6 Month #1 Current Balance: $100.00 Please enter total amount of deposits: $2000 Please enter total amount of withdrawals: $200 New Balance: $1905.00 Month #2 Current Balance: $1905.00 Please enter total amount of deposits: $3000 Please enter total amount of withdrawals: $2000 New Balance: $2917.03 Month #3 Current Balance: $2917.03 Please enter total amount of deposits: $4000 Please enter total amount of withdrawals: $2000 New Balance: $4936.61 Start Balance: Total Deposits: Total Withdrawals: $4200.00 Total Interest Earned: $36.61 Final Balance: $100.00 $9000.00 $4936.61 Test Case3: this tests for invalid values for deposit and withdrawal amounts. Welcome to Your Bank! what is your starting Balance? $100 what is the annual interest rate?. Please enter whole value. For example 6 for 6% :8 Month #1 Current Balance: $100.00 Please enter total amount of deposits: $-20 Deposit must be a positive number! Please enter total amount of deposits: $2e0 Please enter total amount of withdrawals: $-30 withdrawal must be a positive number and not be larger than balance: $300.e0 Please enter total amount of withdrawals: $20 New Balance: $281.27 Month #2 Current Balance: $281.27 Please enter total amount of deposits: $500 Please enter total amount of withdrawals: $100 New Balance: $684.48 Month #3 Current Balance: $684.48 Please enter total amount of deposits: $-30 Deposit must be a positive number! Please enter total amount of deposits: $3000 Please enter total amount of withdravals: $-60 withdrawal must be a positive number and not be larger than balance: $3684.48 Please enter total amount of withdravals: $600 New Balance: $3097.04 Start Balance: Total Deposits: Total Withdrawals: Total Interest Earned: $17.04 Final Balance: $100.00 $3700.00 $720.00 3097.04

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

6. Are my sources reliable?

Answered: 1 week ago

Question

5. Are my sources compelling?

Answered: 1 week ago