There is a legend that claims that everyday a prince would


Can someone assist me with the program code for this assignment?

There is a legend that claims that everyday a Prince would pass a  beggar in the streets. One day the Prince offered to give the beggar  a million dollars that day, or a penny that day and double it every day  for a month. The beggar accepted the latter. Calculate the total amount  the Prince would have given the beggar after 30 days. ALSO: Display a  message each day with the day number and the amount paid that day.
ALSO: display a message stating the day that the total surpassed $1 million.  Finally, display a message stating the overall total for the entire 30 days.

Here is the expected output; your program has to do this properly, do not just replicate the output!

day 1: 1 pennies.
day 2: 2 pennies.
day 3: 4 pennies.
day 4: 8 pennies.
day 5: 16 pennies.
day 6: 32 pennies.
day 7: 64 pennies.
day 8: 128 pennies.
day 9: 256 pennies.
day 10: 512 pennies.
day 11: 1024 pennies.
day 12: 2048 pennies.
day 13: 4096 pennies.
day 14: 8192 pennies.
day 15: 16384 pennies.
day 16: 32768 pennies.
day 17: 65536 pennies.
day 18: 131072 pennies.
day 19: 262144 pennies.
day 20: 524288 pennies.
day 21: 1048576 pennies.
day 22: 2097152 pennies.
day 23: 4194304 pennies.
day 24: 8388608 pennies.
day 25: 16777216 pennies.
day 26: 33554432 pennies.
day 27: 67108864 pennies. * MILLION DOLLAR MARK!
day 28: 134217728 pennies.
day 29: 268435456 pennies.
day 30: 536870912 pennies.

Total amount paid: 1073741824 pennies

NOTE: DO NOT USE GLOBAL VARIABLES!!!!!
A global variable is a variable that is defined outside of any function (including main). We don't cover them in this course because they are generally a very bad idea. So, don't do this in your projects!

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: There is a legend that claims that everyday a prince would
Reference No:- TGS0960796

Now Priced at $20 (50% Discount)

Recommended (94%)

Rated (4.6/5)