Answered step by step
Verified Expert Solution
Question
1 Approved Answer
you were asked to create a program that would calculate the balance of a savings account after six months. In this lab, we will
you were asked to create a program that would calculate the balance of a savings account after six months. In this lab, we will revisit the monthly interest calculation program but add one additional feature. In this program you will add the ability for the user to enter the number of months they plan on saving. Write a program that asks the user the following: the amount to be deposited each month (double) the annual interest rate percentage (double) the number of months they wish to save (int) Your program must perform input validation on all three numbers entered by the user to ensure the deposited amount and annual interest are doubles and that the number of months is an integer. Print out the monthly balance over the specified savings duration. Remember to include both the first and last month of your period. After the program has finished, ask the user if they would like to try another calculation. Use input validation to ensure the user answers with a 'Y' or an 'N'. Keep the program running in an infinite loop until the user indicates they want to quit. Hint: To add commas to your formatted string, simply add a comma to your format scheme. Example: printf("Balance is: $%,.2f",balance) Example Run This program will ask the user for a monthly deposit, an annual interest rate, and the number of months the user plans on saving. It will then show the monthly balance over the period of planned savings. Please enter the amount to be deposited each month: a lot! Invalid response! Please enter a number. Please enter the amount to be deposited each month: 250.50 Please enter the annual interest rate: 3.75 Please enter the number of months you plan to save eighteen Invalid response! Please enter a whole number. Please enter the number of months you plan to save: 18 1/3
Step by Step Solution
There are 3 Steps involved in it
Step: 1
The simple program in C that fulfills the requirements youve described include int ...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