Prince would pass a beggar in the streets

Assignment Help Basic Computer Science
Reference no: EM13707530

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

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!

Reference no: EM13707530

The unique identification number assigned

The unique identification number assigned to your computer when you connect to the internet if known as all the following EXCEPT:A. dotted quad B. dotted decimal C. path D. IP

Compare the computational complexity of the laplacian

Compare the computational complexity of the Laplacian regularized least-squares algorithm with that of the regularized least-squares algorithm using labeled examples only.

Important aspect of formatting

1. Which rules does an expert have to follow to prepare and submit a report? 2. What is destroying a report before the final resolution of a case called? 3. When writing a rep

Create buttons to launch these procedurs

Create buttons to launch these procedures. Compare and contrast your different methods. Is one of these more efficient? Is one of them more realistic? In what situations wou

Information for building project

This exercise begins with information for a building project. Working in Microsoft Project, you will create the task list, including summary tasks and their sub-tasks, creat

Determine the taylor series expansion

For the function 1/(z - 2), determine the Taylor series expansion about each of the given points. Use the known series expansion for 1/(1 - z). State the radius of covergenc

Determine why that happens by closely examining your code

You may have noticed that for some runs, ga terminates with an error that the nonlinear constraint file is not returning a real value. Determine why that happens by closely ex

Write a program that discovers all anagrams of all words

When your dictionary file is sorted, the word "program" would be placed before the word "computer", because its canonical form comes first in alphabetical order. Write code


Write a Review

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd