must be done using a while loop with nested statements Write a Python program that calculates the value of an investment with interest compounding annually. The program should allow the user to enter the beginning balance and the interest rate. This interest rate should be entered as a decimal number. For example, it should be entered as .05, instead of 5%. The program should output a table of the balance for each year. It should stop when the balance has tripled. It should also display when the balance has doubled. Be sure to right-align and format the year and balance numbers as shown in the samples below. Also, don’t forget to include your header and step comments in your code. Your program should function like this … Sample 1

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

** must be done using a while loop with nested statements

Write a Python program that calculates the value of an investment with interest compounding annually. The program
should allow the user to enter the beginning balance and the interest rate. This interest rate should be entered as a
decimal number. For example, it should be entered as .05, instead of 5%. The program should output a table of the
balance for each year. It should stop when the balance has tripled. It should also display when the balance has doubled.
Be sure to right-align and format the year and balance numbers as shown in the samples below. Also, don’t forget to
include your header and step comments in your code.
Your program should function like this …
Sample 1

Sample 2:
Enter the beginning balance: 3000
Enter the interest rate (such as .045) : .05
Year
Current Balance
3,150.00
3,307.50
3,472.88
3,646.52
3,828.84
4,020.29
4,221.30
4,432.37
4,653.98
4,886.68
5,131.02
5,387.57
5,656.95
5,939.79
6,236.78
1
2
3
4
5
6
7
8.
9.
10
11
12
13
14
15
The beginning balance doubled in 15 years.
6,548.62
6,876.05
7,219.86
16
17
18
19
7,580.85
20
7,959.89
21
8,357.89
22
8,775.78
23
9,214.57
The beginning balance tripled in 23 years.
Transcribed Image Text:Sample 2: Enter the beginning balance: 3000 Enter the interest rate (such as .045) : .05 Year Current Balance 3,150.00 3,307.50 3,472.88 3,646.52 3,828.84 4,020.29 4,221.30 4,432.37 4,653.98 4,886.68 5,131.02 5,387.57 5,656.95 5,939.79 6,236.78 1 2 3 4 5 6 7 8. 9. 10 11 12 13 14 15 The beginning balance doubled in 15 years. 6,548.62 6,876.05 7,219.86 16 17 18 19 7,580.85 20 7,959.89 21 8,357.89 22 8,775.78 23 9,214.57 The beginning balance tripled in 23 years.
Sample 1:
Enter the beginning balance: 5000
Enter the interest rate (such as .045): .075
Year
Current Balance
1
5,375.00
5,778.12
6,211.48
ו35 . ר67 ,6
7,178.15
7,716.51
8,295.25
8,917.39
9, 586.19
10,305.16
2
3
4
5
6.
9
10
The beginning balance doubled in 10 years.
11,078.04
11,908.90
12,802.07
13,762.22
14,794.39
15,903.97
11
12
13
14
15
16
The beginning balance tripled in l6 years.
Transcribed Image Text:Sample 1: Enter the beginning balance: 5000 Enter the interest rate (such as .045): .075 Year Current Balance 1 5,375.00 5,778.12 6,211.48 ו35 . ר67 ,6 7,178.15 7,716.51 8,295.25 8,917.39 9, 586.19 10,305.16 2 3 4 5 6. 9 10 The beginning balance doubled in 10 years. 11,078.04 11,908.90 12,802.07 13,762.22 14,794.39 15,903.97 11 12 13 14 15 16 The beginning balance tripled in l6 years.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education