Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

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!

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91246946
  • Price:- $20

Priced at Now at $20, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Does bmw have a guided missile corporate culture and

Does BMW have a guided missile corporate culture, and incubator corporate culture, a family corporate culture, or an Eiffel tower corporate culture?

Discuss the importance of using an access control model in

Discuss the importance of using an access control model in determining how employees in an organization should gain access to resources.

Suppose you have an object made up of two w-bit integers x

Suppose you have an object made up of two w-bit integers, x and y. Suppose that the hash code for your object is defined by some deterministic function h(x; y) that produces a single w-bit integer. Prove that there exist ...

Assignmentthe results of the spec cpu2006 bzip2 benchmark

Assignment The results of the SPEC CPU2006 bzip2 benchmark running on an AMD Barcelona has an instruction count of 2.389E12, an execution time of 750 s, and a reference time of 9650 s. 1) Find the CPI if the clock cycle ...

Create login form to enter user name and a password textbox

Create login form to enter user name and a password textbox to enter password, and write procedure to simulate the process of triggering the login process after hitting the Enter Key.

Question suppose you need to manually sort a hand of cards

Question : Suppose you need to manually sort a hand of cards. What techniques, other than a bubble sort, would you implement? Describe one or more algorithms at a high level.

Question sinksort is a f times n which helps sort

Question : Sinksort () is a f times n which helps sort sequences, in order to do so it makes switches (adjacent doubleheadarrow). Write a function which sorts a given sequence from smallest to largest.

Albert hoffmans wife has an ipod shuffle with five songs in

Albert Hoffman's wife has an iPod shuffle with five songs in her library: November Rain  by Guns 'N Roses Ain't No Mountain High Enough  by Nicholas Ashford and Valerie Simpson Call Me Maybe  by Carly Rae Jepsen Rainbow ...

1 a university found that 10 of students withdraw from a

1. A university found that 10% of students withdraw from a math course. Assume 25 students are enrolled. a. Write the appropriate probability distribution function with the specific parameters for this problem. b. Comput ...

Suppose that a data warehouse consists of the four

Suppose that a data warehouse consists of the four dimensions date, spectator, location, and game, and the two measures count and charge, where charge is the fare that a spectator pays when watching a game on a given dat ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As