Question: You are to write a program that calculates the amount of money a person would earn over a period of time if his or her
You are to write a program that calculates the amount of money 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 ask the user for the number of days worked. Display a table showing what the salary was for each day, then show the total pay at the end of the period. The output should be displayed in a dollar amount, not the number of pennies.
Additional Program Requirements:
Input number of days by keyboard- use Scanner class
use while loop to check input - number is > = 1, break to end
format output to display numbers in table in format $1,310.70 - use printf method
test with 16 days Enter the number of days for your salary? 16 -
Output: The day is 1 and the pay is $0.02
The day is 2 and the pay is $0.04
The day is 3 and the pay is $0.08
The day is 4 and the pay is $0.16 ......and so on
The day is 16 and the pay is $655.36
The total pay $1,310.70
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
