Question: C++ Program using Control Structures (no arrays) The program requires you to compute interests and balances for several savings accounts in a bank. The bank

C++ Program using Control Structures (no arrays)

The program requires you to compute interests and balances for several savings accounts in a bank. The bank pays annual interest on savings accounts according to the following schedule:

Balance Rate overdrawn accounts no interest 0 thru $99.99 2.0% $100.00 thru $999.99 3.0% $1000.00 and above 4.0%

The interest is compounded monthly. This means a customer with a balance of $50.00 earns an interest of (1/12X 2/100 X 50.00) dollars at the end of the month. This interest is added to the $50.00 and the sum becomes the current balance. No interest is paid on overdrawn accounts.

Given the initial balance of anumber of accounts, write a program to find the final balance of each account at the end of a specified period of time. You may assume no withdrawals or deposits will be made during the specified period of time. Your program should also find the sum of all final balances.

You will be provided the input data file (in electronic form) for this program.

An example file that looks like the data file is shown on the other side of this sheet. You may use this example data file for program development. Your program should not be hardcoded for this example data file, rather your program should work for any data file that has the right format.

The first number in the data file (an integer) is the number of accounts to be processed. Data for the accounts follow on subsequent lines. For each account, three numbers are given per line as follows:

1. Four-digit account number, an integer. 2. Initial balance, a decimal number. 3. Number of months over which interest is to be computed, an integer.

Note that a negative initial balance indicates an overdrawn account. Your program should read the data directly from the data file, since the number of accounts in the file may change. Your program should work correctly for any number of accounts as specified in the data file.

Your output should consist of four columns for each customer: account number, number of months, initial balance, and final balance. The last line of your output should be the sum of all final balances. Note that the final balance for an overdrawn account is the same as the initial balance. All balances printed by your program should be printed with two decimal places.

Example Data for Program 2

11 2871 2.19 8 1234 95.04 23 3341 0.00 10 3221 -1.08 21 7462 404.14 4 3425 4784.00 200 3701 99.50 4 2701 -99.54 4 3532 999.50 7 4512 50.00 15 3667 500.00 15 JUNK, SHOULD NEVER GET HERE 3333 0,0,0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!