Modify the program from this section so that the user can supply the interest rate. For very small interest rates, it may take a very long time for the balance to double. Assume the user can't wait for more than twenty years. Stop adding interest when the balance has doubled or twenty years have elapsed. Complete the following file:

Microsoft Windows 10 Comprehensive 2019
1st Edition
ISBN:9780357392607
Author:FREUND
Publisher:FREUND
Chapter7: Microsoft Edge
Section: Chapter Questions
Problem 1EYK
icon
Related questions
Question
Safari
File
Edit
View
History
Bookmarks Develop Window
Help
A 12% O
Mon 2:01 PM
Not Secure - codecheck.io
EL Fast Li.
O 20FA C.
5 (U%)
4.1 The...
Post At..
Post At..
c Your As..
* Start P.
W Homep..
JSLinux
G fabrice.
JSLinux
G how do.
T(100%)
Z (100%)
3 (100%)
4 (U%)
Modify the program from this section so that the user can supply the interest rate. For very small interest rates, it may take a very long time for the balance to double. Assume the user
can't wait for more than twenty years. Stop adding interest when the balance has doubled or twenty years have elapsed.
Complete the following file:
doubleinv.cpp
1
#include <iostream>
3 using namespace std;
4
int main()
6 {
7
const double INITIAL_BALANCE = 10000;
8
const double TARGET = 2 * INITIAL_BALANCE;
10
double balance =
INITIAL_BALANCE;
11
int year = 0;
12
cout << "Interest rate in percent:
double rate;
cin >> rate;
13
« endl;
14
15
16
17
// TODO: Count the years required for the investment to double
18
cout << "Year: " << year << endl;
cout << "Balance:
19
20
« balance « endl;
21
22
return 0:
6,802
Transcribed Image Text:Safari File Edit View History Bookmarks Develop Window Help A 12% O Mon 2:01 PM Not Secure - codecheck.io EL Fast Li. O 20FA C. 5 (U%) 4.1 The... Post At.. Post At.. c Your As.. * Start P. W Homep.. JSLinux G fabrice. JSLinux G how do. T(100%) Z (100%) 3 (100%) 4 (U%) Modify the program from this section so that the user can supply the interest rate. For very small interest rates, it may take a very long time for the balance to double. Assume the user can't wait for more than twenty years. Stop adding interest when the balance has doubled or twenty years have elapsed. Complete the following file: doubleinv.cpp 1 #include <iostream> 3 using namespace std; 4 int main() 6 { 7 const double INITIAL_BALANCE = 10000; 8 const double TARGET = 2 * INITIAL_BALANCE; 10 double balance = INITIAL_BALANCE; 11 int year = 0; 12 cout << "Interest rate in percent: double rate; cin >> rate; 13 « endl; 14 15 16 17 // TODO: Count the years required for the investment to double 18 cout << "Year: " << year << endl; cout << "Balance: 19 20 « balance « endl; 21 22 return 0: 6,802
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Windows 10 Comprehensive 2019
Microsoft Windows 10 Comprehensive 2019
Computer Science
ISBN:
9780357392607
Author:
FREUND
Publisher:
Cengage