Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Ask the user for an amount to save each month. Assuming a 1% per month interest rate, how many MONTHS will it take the user

Ask the user for an amount to save each month. Assuming a 1% per month interest rate, how many MONTHS will it take the user to save $1000. Add the savings at the END of each month. For example:

How much do you want to save each month? 100 Month 1: $0 deposited 100 interest earned is 1 Month 2: $101 deposited 100 interest earned is 2.01 Month 3: $203.01 deposited 100 interest earned is 3.0301 Month 4: $306.04 deposited 100 interest earned is 4.0604 Month 5: $410.101 deposited 100 interest earned is 5.10101 Month 6: $515.202 deposited 100 interest earned is 6.15202 Month 7: $621.354 deposited 100 interest earned is 7.21354 Month 8: $728.567 deposited 100 interest earned is 8.28567 Month 9: $836.853 deposited 100 interest earned is 9.36853 Month 10: $946.221 deposited 100 interest earned is 10.4622 It took 10 months, and you now have $1056.68 

I think I am on the right track but the total for my month1 starts with the value for month2. It should start as 0 but i don't know how to fix this problem.

#include using namespace std; int main () { double total = 0; double intRate = 0.01, interest = 0, amount = 0; int months = 0; cout << "How much do you want to save each month? "; cin >> amount; cout << amount; do { interest = (total + amount) * intRate; total+= amount + interest; cout << " Month " << months + 1 << ": $" << total << " deposited " << amount << " interest earned is " << interest; months++; } while (total <= 1000); cout << " It took " << months << " months, and you now have $" << total << endl; return 0; }

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

Introduction To Constraint Databases

Authors: Peter Revesz

1st Edition

1441931554, 978-1441931559

More Books

Students also viewed these Databases questions

Question

5. If yes, then why?

Answered: 1 week ago

Question

3. What changes should I be making?

Answered: 1 week ago