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

  What is primary security risk users acknowledge using macros

Write a 200- to 300-word response that answers the following question: Based on the article by Lenning (2005), what is a primary security risk that users should acknowledge when using macros?

  Positive and negative characteristics of hybrid databases

A idea that several of the main database vendors have come up with is a hybrid database that integrates the concepts of both OO and Relational databases.

  Design application to accept reader data

Design an application that accepts reader data and produces a count of readers by age groups as follows: under 20, 20-29, 30-39, 40-49, and 50+.

  Write a program that requests a person weight and height

Write a program that requests a person's weight and height as input and displays the person's body mass index.

  What is incremental analysis how is it used by management

1. Our lecture states that relevant costs can also be viewed as avoidable costs. What does this mean? This is a very difficult concept, so help your classmates understand it!2. What is incremental analysis? How is it used by management?

  Explain how to structure worksheet including titles

Explain how you will structure the worksheet, including the titles, column headings, and formulas to calculate the time it takes to make each size of cage.

  You enable completeonly specific input element true or false

You can enable auto complete only for specific input element. True or False

  Identity tangible and intangible benefits of the new payroll

suppose you own a travel agency in a large city you have many clients but growth has slowed somewhat. some long term employees are getting discouraged, but feels that there might be a way to make technology work in favor. use your imagination and sug..

  Problems a team may encounter during a project life cycle

Discussion, consider some of the problems a team may encounter during a project life cycle: Question: What are some of the typical problems a project team may encounter during a project's life cycle?

  Write for loops to produce the following output

Write for loops to produce the following output

  What is the expected number of floors the elevator stops

What is the expected number of floors the elevator stops

  How many times each integer was generated

Initialize each item in the second array to 0. For each item in the first array, use it as the index into the second array and increment the contents found in the second array at the corresponding index.

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