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:
Valid: $ 1.34 , $ 0.05 , $ 123.45
Please enter the number of days worked: -1 Invalid number of days. Try again Please enter the number of days worked: 0 Invalid number of days. Try again Please enter the number of days worked: 5 Day Amount Earned ------------------------------------------- 1 $ 0.01 2 $ 0.02 3 $ 0.04 4 $ 0.08 5 $ 0.16 Total earnings: $ 0.31
Please enter the number of days worked: 18 Day Amount Earned ------------------------------------------- 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 $ 1310.72 Total earnings: $ 2621.43
Write a program that will allow the user to enter a set of integers (as many as they want), then prints out a summary of information, as follows:
Input integer (0 to stop): 12 Input integer (0 to stop): 4 Input integer (0 to stop): -1 Input integer (0 to stop): -5 Input integer (0 to stop): 18 Input integer (0 to stop): 0 Total: 5 Sum: 28 Average: 5.60 Divisible by 9: 1 Max: 18 Min: -5
Input integer (0 to stop): 4 Input integer (0 to stop): 8 Input integer (0 to stop): 24 Input integer (0 to stop): 95 Input integer (0 to stop): 81 Input integer (0 to stop): -1 Input integer (0 to stop): 43 Input integer (0 to stop): 27 Input integer (0 to stop): 44 Input integer (0 to stop): -18 Input integer (0 to stop): 13 Input integer (0 to stop): 0 Total: 11 Sum: 320 Average: 29.09 Divisible by 9: 3 Max: 95 Min: -18
----------- Menu ----------- 1. Krabby Patty ...... $3.50 2. Barnicle Fries .... $1.50 3. Kelp Shake ........ $1.00 4. Krusty Krab Pizza . $5.00
Welcome to the Krusty Krab! ----------- Menu ----------- 1. Krabby Patty ...... $3.50 2. Barnicle Fries .... $1.50 3. Kelp Shake ........ $1.00 4. Krusty Krab Pizza . $5.00 What would you like? (Enter 0 to finish order!): 2 How many: 1 ----------- Menu ----------- 1. Krabby Patty ...... $3.50 2. Barnicle Fries .... $1.50 3. Kelp Shake ........ $1.00 4. Krusty Krab Pizza . $5.00 What would you like? (Enter 0 to finish order!): 4 How many: 1 ----------- Menu ----------- 1. Krabby Patty ...... $3.50 2. Barnicle Fries .... $1.50 3. Kelp Shake ........ $1.00 4. Krusty Krab Pizza . $5.00 What would you like? (Enter 0 to finish order!): 0 Your order: 1 barnacle fries. 1 krusty krab pizzas. Your total is $6.50 Enjoy the food!
Welcome to the Krusty Krab! ----------- Menu ----------- 1. Krabby Patty ...... $3.50 2. Barnicle Fries .... $1.50 3. Kelp Shake ........ $1.00 4. Krusty Krab Pizza . $5.00 What would you like? (Enter 0 to finish order!): 8 That isn't on the menu! Try again. ----------- Menu ----------- 1. Krabby Patty ...... $3.50 2. Barnicle Fries .... $1.50 3. Kelp Shake ........ $1.00 4. Krusty Krab Pizza . $5.00 What would you like? (Enter 0 to finish order!): 2 How many: -5 You can't order a negative amount of food! Try Again: -7 You can't order a negative amount of food! Try Again: -9 You can't order a negative amount of food! Try Again: 1 ----------- Menu ----------- 1. Krabby Patty ...... $3.50 2. Barnicle Fries .... $1.50 3. Kelp Shake ........ $1.00 4. Krusty Krab Pizza . $5.00 What would you like? (Enter 0 to finish order!): 0 Your order: 1 barnacle fries. Your total is $1.50 Enjoy the food!
Welcome to the Krusty Krab! ----------- Menu ----------- 1. Krabby Patty ...... $3.50 2. Barnicle Fries .... $1.50 3. Kelp Shake ........ $1.00 4. Krusty Krab Pizza . $5.00 What would you like? (Enter 0 to finish order!): 0 Guess you aren't hungry.
Welcome to the Krusty Krab! ----------- Menu ----------- 1. Krabby Patty ...... $3.50 2. Barnicle Fries .... $1.50 3. Kelp Shake ........ $1.00 4. Krusty Krab Pizza . $5.00 What would you like? (Enter 0 to finish order!): 1 How many: 3 ----------- Menu ----------- 1. Krabby Patty ...... $3.50 2. Barnicle Fries .... $1.50 3. Kelp Shake ........ $1.00 4. Krusty Krab Pizza . $5.00 What would you like? (Enter 0 to finish order!): 1 How many: 2 ----------- Menu ----------- 1. Krabby Patty ...... $3.50 2. Barnicle Fries .... $1.50 3. Kelp Shake ........ $1.00 4. Krusty Krab Pizza . $5.00 What would you like? (Enter 0 to finish order!): 0 Your order: 5 krabby patties. Your total is $17.50 Enjoy the food!
Format:
~myers/csub/submit3 yourfilenamehereExample:
~myers/csub/submit3 pennies.cppDo this for each of your files.