Question
Write a program that calculates the amount of money a person would earn over a period of time if his or her salary is
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. 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. Input: 20 Expected Output Enter the number of days: Day Pennies 1 $0.01 2 $0.02 3 $0.04 4 $0.08 5 $0.16 6 $0.32 7 $0.64 8 $1.28 9 $2.56 10 $5.12 11 $10.24 12 $20.48 13 $40.96 14 $81.92 15 $163.84 16 $327.68 17 $655.36 18 $1,310.72 19 $2,621.44 20 $5,242.88 The total salary for 20 days is: $10,485.75
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get StartedRecommended Textbook for
Data Analysis And Decision Making
Authors: Christian Albright, Wayne Winston, Christopher Zappe
4th Edition
538476125, 978-0538476126
Students also viewed these Programming questions
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
View Answer in SolutionInn App