Question

Write most basic C++ program possible that calculates monthly savings account balance. Program will prompt user...

Write most basic C++ program possible that calculates monthly savings account balance. Program will prompt user to enter initial account balance, annual percentage rate, amount deposited each month, and total number of months. Validate user inputs allowing only positive numbers.

B = initial account balance

A = amount deposited each month

R = annual percentage rate

Total Balance = (R/12+1)B+A

Homework Answers

Answer #1

#include <iostream>

using namespace std;

int main(){

double initial_account_balance,total_balance;

double annual_percentage_rate,monthly_interest;

double amount_deposited;

double number_of_months;

while(true){

cout<<"ENter positive initial account balance :";

cin>>initial_account_balance;

if(initial_account_balance>0)break;

}

while(true){

cout<<"ENter positive annual percentage rate :";

cin>>annual_percentage_rate;

if(annual_percentage_rate>0)break;

}

while(true){

cout<<"ENter positive amount deposited:";

cin>>amount_deposited;

if(amount_deposited>0)break;

}

while(true){

cout<<"ENter positive number of months :";

cin>>number_of_months;

if(number_of_months>0)break;

}

total_balance=initial_account_balance;

monthly_interest=annual_percentage_rate/12;

for(int i=1;i<=number_of_months;i++){

total_balance+=total_balance*monthly_interest;

}

cout<<total_balance<<endl;

return 0;

}

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Problem 2 write Pseudocode for a program that calculates and displays a customer's bank balance at...
Problem 2 write Pseudocode for a program that calculates and displays a customer's bank balance at the end of a month. The customer's bank balance at the end of the month is the beginning bank balance + the total amount of monthly deposit made - the total amount of monthly withdrawals made + interest earned. The information the program will need to get from the user is the beginning bank balance, the amount of monthly deposits , the amount of...
A Cable Company has hired you to write a C++ program that calculates the monthly bill...
A Cable Company has hired you to write a C++ program that calculates the monthly bill for their customers. It must meet the following specifications: The program must first greet the customer. The program must then ask for their name, the number of basic channels packages they’re subscribed to, then the number of premium channel packages they’re subscribed to. The bill is calculated as follows: There is a $75 base fee. The first 3 basic channels packages are free, after...
Python code only! (Do not include breaks or continue functions) Write a program that asks the...
Python code only! (Do not include breaks or continue functions) Write a program that asks the user to enter the amount that they budgeted for the month. A loop should then prompt the user to enter their expenses, one at a time and to enter 0 to quit. When the loop finishes, the program should display the the amount of budget left. (a negative number indicates the user is over budget and a positive number indicates the user is under...
C++ Write a program that calculates and prints the total grade for n assignments as a...
C++ Write a program that calculates and prints the total grade for n assignments as a percentage. Prompt the user to enter the value of n, followed by the number of points received and number of points possible for each assignment . Calculate and print the total number of points received, total number of points possible, and the overall percentage: (total points received / total points possible) * 100. Output: Enter·number·of·assignments·to·input:3↵ Enter·number·of·points·received·for·assignment·1 :10↵ Enter·number·of·possible·points·for·assignment·1 :10↵ Enter·number·of·points·received·for·assignment·2 :7↵ Enter·number·of·possible·points·for·assignment·2 :12↵ Enter·number·of·points·received·for·assignment·3...
Hi, I need a program in C, where it will prompt a user for a math...
Hi, I need a program in C, where it will prompt a user for a math quiz, either easy or medium. If the user choses difficulty easy, it will prompt the user for how many questions they would like from 1-5. If the user enters medium it will prompt the user on how many questions they would like from 1-10. After those prompts are entered questions will be displayed using rand(), the questions must be multiple choice or division, aswell...
Number of years= 20 Number of months=240 Annual Percentage Rate=8.00% Monthly interest rate=0.67% Loan amount=$441,747 Fixed...
Number of years= 20 Number of months=240 Annual Percentage Rate=8.00% Monthly interest rate=0.67% Loan amount=$441,747 Fixed monthly repayment amount=$ 3,694.95 1. The borrower actually had to pay $250 more each month due to hidden fees and charges. Calculate the implied nominal interest rate compounded monthly, the borrower is actually charged on the loan taking into account these charges 2. Total amount of interest paid in the 3rd year? 3. The total principle paid in the 4th year? 4. The amount...
After graduating from High School Peter works for four years. During this time he deposits each...
After graduating from High School Peter works for four years. During this time he deposits each month R 1000 on a savings account at an annual interest rate of 5% (no initial deposit). The next four years Peter spends on College. During this time he withdraws each month an amount of R pw from his savings account so that at the end of the four years the balance is zero again. Develop a mathematical model then find pw and the...
2. Suppose you will receive $1,000 in 4 years. If your opportunity cost is 6% annually,...
2. Suppose you will receive $1,000 in 4 years. If your opportunity cost is 6% annually, what is the present value of this amount if interest is compounded every six months? (8 points) What is the effective annual rate? (8 points) 3. Suppose you have deposited $10,000 in your high-yield saving account today. The savings account pays an annual interest rate of 4%, compounded semi-annually. Two years from today you will withdraw R dollars. You will continue to make additional...
Amortization Schedule Project Program an Excel Spreadsheet to complete a Fixed Payment Loan Amortization Schedule based...
Amortization Schedule Project Program an Excel Spreadsheet to complete a Fixed Payment Loan Amortization Schedule based on the 5 inputs (see 1a below). This spreadsheet should work for any scenario chosen using the 5 inputs below that does not exceed 360 periods. You may start with any 5 inputs as these will be changed multiple times during grading. All cells with number format should have no decimal places. All cells with accounting format should have 2 decimal places. All cells...
Part 2 (matlab) Functions Many of you will have some form of a loan during your...
Part 2 (matlab) Functions Many of you will have some form of a loan during your lifetime, either a student loan, mortgage, credit card debt, or other loan. If you never do have a loan, great! But you may have to calculate a payment for someone else, such as the company you work for. Such a loan will have a principal amount (called the present value), an interest rate, and a number of periods for the loan. The formula to...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT