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

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!

Reference no: EM13707530

Questions Cloud

What is the speed of the car at the end of that time : A car accelerates from rest at a constant rate of 2.4m/s2 for 5.0s. What is the speed of the car at the end of that time
Dna rights-who owns your genetic code : Research the history, examples, causes, impacts ancftthical issues surrounding the subject. Be sure to understand the arguments being used by all parties. There may be more than 2 sides of the issue.
What horizontal force is required to move the box : A 6.27kg box sits on a ramp that is inclined at 37.0 degrees above the horizontal. The coefficient of kinetic friction between the box and the ramp is 0.30. What horizontal force is required to move the box
Find her average speed in meters per second : A senior citizen walks 0.40km in 12min , going around a shopping mall. What is her average speed in meters per second
Prince would pass a beggar in the streets : 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 ..
Cloud computing : Select two (2) organizations in which you are interested, and use the Internet and Strayer Library to research the advantages and disadvantages of cloud computing for the selected organizations. Use the Internet to research the characteristics ..
Find at what angle should the player aim the ball : A basketball player is 15 ft horizontally from the center of the basket, which is 10 off the ground. At what angle should the player aim the ball if it is thrown from a height of 8.2 ft with a speed of 28 ft/s
Calculate the terminal velocity for a pollen grain : Calculate the terminal velocity for a pollen grain falling through the air using the drag force equation. Assume the pollen grain has a diameter of 2 µm and a density of 0.4 g/cm3
Develop a logical design for this enterprise campus : Develop a logical design for this enterprise campus that considers the seven network architecture components. There are no other campuses, so you can omit WAN access. You will need to make some assumptions, so be sure to document your assumptions ..

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Knowledge management systems important-modern organization

Describe in scholarly detail why knowledge management systems would be so important to a modern organization where the organization would initiate.

  Build a sorted double-linked list such

For example, you build a list of characters, then you can print it out as: "a b c d e" or "e d c b a". The input is of an random character list is from the keyboard.

  Design a scheme to prevent messages from being modified

Random J. Protocol-Designer has been told to design a scheme to prevent messages from being modified by an intruder.

  Design patterns in today-s development environments

In System Analysis and Design: Design Patterns - How widely used are design patterns in today's development environments?

  Use active directory to establish security group memberships

How would you manage creation of novel user accounts in this organization? Utilizing Active Directory to establish security group memberships or manual creation and security.

  Flexible single master operations roles

Flexible Single Master Operations Roles

  What is stored in alpha after the following code executes

What is stored in alpha after the following code executes? int alpha[5] = {0}; int j; for (j = 0; j 2) alpha[j - 1] = alpha[j] + 2; }

  A net-work technician for a global news service with 200

A net-work technician for a global news service with 200

  Which address should be evicted at each replacement

An MRU replacement policy? Which address should be evicted at each replacement to maximize the number of hits? How many hits does this address sequence exhibit if you follow this optimal policy?

  Explain why logic is an important part of oop

Logic is a key factor in laying out the processes for programming a game/application/website. Explain why logic is an important part of OOP.

  Design a program that prompts the user to enter a string

Design a program that prompts the user to enter a string. The program should then display the number of vowels and the number of consonants in the string. I am absolutely lost and don't even know how to start, any assistance would be appreciated.

  Expressions to a minimum sop or pos

Simplify each of the subsequent expressions to a minimum SOP or POS and sketch the circuit using AND, OR, and NOT gates.

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