Write a program for computing the amount of money in a bank account at the end of each quarter for a period of one year. A quarter is equivalent to 3 months. Assume that the account is created at the beginning of a year (i.e. January 1). The year will be entered at run time through the keyboard. The account has an initial principal that is entered at run time through the keyboard. No deposit or withdrawal is made within the one-year period. The interest is compounded quarterly which means that the interest earned for the first quarter will form part of the principal for the second quarter, the interest earned for the second quarter will form part of the principal for the third quarter and so on. The annual interest rate is 5%. The interest rate for a quarter is computed by dividing the annual interest rate by 4 since there are four quarters in a year. The computational procedure (see algorithm) and the output of the program (see sample run) are shown below. The output includes a table showing the year, quarter number, interest earned and the new principal. The new principal is the amount at the end of the quarter.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter5: Control Structures Ii (repetition)
Section: Chapter Questions
Problem 20PE: When you borrow money to buy a house, a car, or for some other purpose, you repay the loan by making...
icon
Related questions
Question
Display the column headings for the table.
Compute the interest rate for a quarter.
Let quarter be 1.
Compute the interest earned for the first quarter
Compute the new amount (amount at the end of the first quarter)
Display the year, quarter, interest earned and balance at the end of 1st quarter
Let quarter be 2
Compute the interest earned for the second quarter
Compute the new amount (amount at the end of the second quarter)
Display the year, quarter, interest earned and balance at the end of 2nd quarter
Let quarter be 3.
Compute the interest earned for the third quarter
Compute the new amount (amount at the end of the third quarter)
Display the year, quarter, interest earned and balance at the end of 3rd quarter
Let quarter be 4.
Compute the interest earned for the fourth quarter
Compute the new amount (amount at the end of the fourth quarter)
Display the year, quarter, interest earned and balance at the end of 4th quarter
SAMPLE RUN:
Enter the year: 2005
Enter the initial principal: 10000.e0
Principal: 100eo.ee
Annual Interest Rate: 5.00%
Quarter
Year
Interest Earned
Amount at end of quarter
10125.00
2005
125.00
2005
126.56
128.14
10251.56
2005
3
10379.70
2005
129.75
10509.45
IN34
Transcribed Image Text:Display the column headings for the table. Compute the interest rate for a quarter. Let quarter be 1. Compute the interest earned for the first quarter Compute the new amount (amount at the end of the first quarter) Display the year, quarter, interest earned and balance at the end of 1st quarter Let quarter be 2 Compute the interest earned for the second quarter Compute the new amount (amount at the end of the second quarter) Display the year, quarter, interest earned and balance at the end of 2nd quarter Let quarter be 3. Compute the interest earned for the third quarter Compute the new amount (amount at the end of the third quarter) Display the year, quarter, interest earned and balance at the end of 3rd quarter Let quarter be 4. Compute the interest earned for the fourth quarter Compute the new amount (amount at the end of the fourth quarter) Display the year, quarter, interest earned and balance at the end of 4th quarter SAMPLE RUN: Enter the year: 2005 Enter the initial principal: 10000.e0 Principal: 100eo.ee Annual Interest Rate: 5.00% Quarter Year Interest Earned Amount at end of quarter 10125.00 2005 125.00 2005 126.56 128.14 10251.56 2005 3 10379.70 2005 129.75 10509.45 IN34
Problem:
Write a program for computing the amount of money in a bank account at the end of each quarter for a period of
one year. A quarter is equivalent to 3 months. Assume that the account is created at the beginning of a year (i.e.
January 1). The year will be entered at run time through the keyboard. The account has an initial principal that is
entered at run time through the keyboard. No deposit or withdrawal is made within the one-year period. The
interest is compounded quarterly which means that the interest earned for the first quarter will form part of the
principal for the second quarter, the interest earned for the second quarter will form part of the principal for the
third quarter and so on. The annual interest rate is 5%. The interest rate for a quarter is computed by dividing the
annual interest rate by 4 since there are four quarters in a year. The computational procedure (see algorithm) and
the output of the program (see sample run) are shown below. The output includes a table showing the year, quarter
number, interest earned and the new principal. The new principal is the amount at the end of the quarter.
ALGORITHM:
Declare the necessary variables.
Let annual interest rate be set to 0.05. (Note 5.00% = 0.05).
Accept the year.
Accept the initial principal.
Display principal formatted with two digits after decimal point.
Display annual interest rate in percent form.
Transcribed Image Text:Problem: Write a program for computing the amount of money in a bank account at the end of each quarter for a period of one year. A quarter is equivalent to 3 months. Assume that the account is created at the beginning of a year (i.e. January 1). The year will be entered at run time through the keyboard. The account has an initial principal that is entered at run time through the keyboard. No deposit or withdrawal is made within the one-year period. The interest is compounded quarterly which means that the interest earned for the first quarter will form part of the principal for the second quarter, the interest earned for the second quarter will form part of the principal for the third quarter and so on. The annual interest rate is 5%. The interest rate for a quarter is computed by dividing the annual interest rate by 4 since there are four quarters in a year. The computational procedure (see algorithm) and the output of the program (see sample run) are shown below. The output includes a table showing the year, quarter number, interest earned and the new principal. The new principal is the amount at the end of the quarter. ALGORITHM: Declare the necessary variables. Let annual interest rate be set to 0.05. (Note 5.00% = 0.05). Accept the year. Accept the initial principal. Display principal formatted with two digits after decimal point. Display annual interest rate in percent form.
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Random Class and its 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
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr