Principal: 1000 Rate: 12% Year Amount on deposit 1 1120.00 2 1254.40 3 1404.93 4 1573.52 5 1762.34 1973.82 2210.68 8 2475.96 2773.08 10 3105.85

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

C++

This Code displays the following output

Initial principal: 1000
Interest Rate: 5%
Year Amount on deposit
1 1050
2 1102.5
3 1157.63
4 1215.51
5 1276.28
6 1340.1
7 1407.1
8 1477.46
9 1551.33
10 1628.89

Initial principal: 1000
Interest Rate: 6%
Year Amount on deposit
1 1060
2 1123.6
3 1191.02
4 1262.48
5 1338.23
6 1418.52
7 1503.63
8 1593.85
9 1689.48
10 1790.85

Initial principal: 1000
Interest Rate: 7%
Year Amount on deposit
1 1070
2 1144.9
3 1225.04
4 1310.8
5 1402.55
6 1500.73
7 1605.78
8 1718.19
9 1838.46
10 1967.15

Initial principal: 1000
Interest Rate: 8%
Year Amount on deposit
1 1080
2 1166.4
3 1259.71
4 1360.49
5 1469.33
6 1586.87
7 1713.82
8 1850.93
9 1999
10 2158.92

Initial principal: 1000
Interest Rate: 9%
Year Amount on deposit
1 1090
2 1188.1
3 1295.03
4 1411.58
5 1538.62
6 1677.1
7 1828.04
8 1992.56
9 2171.89
10 2367.36

Initial principal: 1000
Interest Rate: 10%
Year Amount on deposit
1 1100
2 1210
3 1331
4 1464.1
5 1610.51
6 1771.56
7 1948.72
8 2143.59
9 2357.95
10 2593.74

The amount of deposit is not properly formatted. Format the amount of deposit to be just like it is in this picture using the given code.

#include <iostream>

#include <iomanip>

#include <cmath>

using namespace std;

int main()

{
double principal{ 1000 };

double rate{ 0.05 };

for (rate; rate <= 0.10; rate += 0.01) {

cout << "" << endl;

cout << "Initial principal: " << principal << endl;

cout << "Interest Rate: " << rate * 100 << "%" << endl;

cout << setw(4) << "Year" << setw(20) << "Amount on deposit" << endl;

for (unsigned int year{ 1 }; year <= 10; year++) {

double amount = principal * pow(1.0 + rate, year);

cout << setw(4) << year << setw(20) << amount << endl;

}

}

}

**Principal:** 1000  
**Rate:** 12%

| **Year** | **Amount on Deposit** |
|:-------:|:--------------------:|
| 1       | 1120.00              |
| 2       | 1254.40              |
| 3       | 1404.93              |
| 4       | 1573.52              |
| 5       | 1762.34              |
| 6       | 1973.82              |
| 7       | 2210.68              |
| 8       | 2475.96              |
| 9       | 2773.08              |
| 10      | 3105.85              |

This table demonstrates the accumulation of a principal amount of 1000 at an annual interest rate of 12%. The "Amount on Deposit" column shows the total amount in the account at the end of each year over a period of 10 years.
Transcribed Image Text:**Principal:** 1000 **Rate:** 12% | **Year** | **Amount on Deposit** | |:-------:|:--------------------:| | 1 | 1120.00 | | 2 | 1254.40 | | 3 | 1404.93 | | 4 | 1573.52 | | 5 | 1762.34 | | 6 | 1973.82 | | 7 | 2210.68 | | 8 | 2475.96 | | 9 | 2773.08 | | 10 | 3105.85 | This table demonstrates the accumulation of a principal amount of 1000 at an annual interest rate of 12%. The "Amount on Deposit" column shows the total amount in the account at the end of each year over a period of 10 years.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 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.
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