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...
Write a program that calculates and displays the amount of money available in a bank account...
Write a program that calculates and displays the amount of money available in a bank account that initially has $8000 deposited in it and that earns interest at the rate of 3.5 percent a year. Your program should display the amount available at the end of each year for a period of 7 years. Use the relationship that the money available at the end of each year equals the amount of money in the account at the start of the...
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...
4) Write a java program where you will use while loop, where if condition is equal...
4) Write a java program where you will use while loop, where if condition is equal to 2 (or any other choice of your number) then it will break the while condition. Steps: 1) Declare variable int (any name) which is equal to zero 2) Declare while condition which variable int is less then equal to 10 3) Declare print out where the value of variable is the same name that you declared in step 1 4) Declare condition if...
For this assignment you'll be creating an application that has the user input a subtotal, tax...
For this assignment you'll be creating an application that has the user input a subtotal, tax rate and tip percentage and then displays the sales tax, tip amount and the total. You'll use JQuery instead of the getElementByX functions AND you will display all messages on the page (no alert or prompt boxes) The starter file is based off of the Lab 2 sales_tax application. Feel free to borrow code from your lab solution but realize you will need to...