Loops 7

Description

The purpose of this challenge is to use the for loop. This challenge uses the concepts of accumulators and loops.

Requirements

  1. Assume you were offered a job that paid $0.01 on the first day, $0.02 the 2nd day, $0.04 the 3rd day (each day’s income is double the previous day’s income)
  2. Display what you made on each day
  3. Calculate and show how much you made for the entire 30 days of work
  4. Remember that you should #include <iomanip> and add the following to display decimal numbers neatly
    cout << fixed << setprecision(2);
    

DO NOT USE

Any power or exponentiation formulas

Sample Interaction / Output

On day 1, you made $0.01
On day 2, you made $0.02
On day 3, you made $0.04
...
(show all days here)
...
On day 29, you made $2684354.56
On day 30, you made $5368709.12
After 30 days, you made $10737418.23

Pay close attention to the last line above that shows the total amount earned having worked 30 days (this is the total amount earned through the 30 days).

Make sure your total shows the amount above, not a penny more, not a penny less.

If you use a method that arrives at $10737418.24 total earnings, do not simply subtract a penny to make it correct. HINT: If you arrive at a number with 24 cents, you are not showing the accumulated earnings for the 30 day period, you are displaying the amount that would be earned on the 31st day

LEGEND
PROGRAM OUTPUT
USER INPUT
FROM INPUT

CATALOG ID: CPP-LOOP0007

Print Requirements