Question: Please write a c++ program Write a program that calculates how much a person would earn over a period of time if his or her

Please write a c++ program
Please write a c++ program Write a program that calculates how much
a person would earn over a period of time if his or

Write a program that calculates how much a person would earn over a period of time if his or her salary is one penny the first day, two pennies the second day, and continues to double each day. The program should proceed as follows: Ask the user for the number of days worked, and allow them to enter it. You may assume this will be an integer A valid entry must be 1 or more days, so whenever the user enters a valid that is not positive (1 or more), print an error message and make them re-enter until they give a valid value. Display a table showing how much the salary was for each day. You can use the \t character to help print neat columns Display the total pay at the end of the period All monetary outputs should be in dollar and cents notation (not just number of pennies), in this format: $ D.cc, where D is the number of dollars, and cc is the cents (always two digits). Examples: Valid: $ 1.34 . $ 0.05, $ 123.45 Sample Run 1 Please enter the number of days worked: -1 Invalid number of days. Try again Please enter the number of days worked: O Invalid number of days. Try again Please enter the number of days worked: 5 Day Amount Earned $ 0.01 $ 0.02 $ 0.04 $ 0.08 $ 0.16 Total earnings: $ 0.31 Sample Run 2 Please enter the number of days worked: 18 Day Amount Earned $ 0.01 $ 0.02 $ 0.04 $ 0.08 $ 0.16 $ 0.32 $ 0.64 $ 1.28 $ 2.56 $ 5.12 $ 10.24 $ 20.48 $ 40.96 $81.92 $ 163.84 $ 327.68 $ 655.36 $ 1310.72 Total earnings: $ 2621. 43

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!