Write a Python program that accepts a positive integer greater than zero from the keyboard. The...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a Python program that accepts a positive integer greater than zero from the keyboard. The program then calls the following functions : 1. currency Calculation (int number): Assuming that the number represent number of pennies, The function computes the number of quarters, dims, nickels, and pennies to be displayed. Displaying as many quarters as possible, then dims, then nickels, and pennies in that order. 2. personAge (int number): Assuming that the number represents a person's age. The function then calculates and displays statistics about the age. Assuming that there are 365 days in a year, The program displays the following information : - Number of months, numbers of days, number of hours, number of minutes, and number of seconds for the person. 3. numberSeparation (int number): Function should separate the numbers into its individual digits and displays on an screen the digits separated from one another by three spaces each. The function then displays each digit of the integer in English. For example, if the number is 42339, the output should be: 4 2 3 39. Four Two Three Three Nine 4. sumOfDigits (int number): A function that accepts the integer value that is entered from the keyboard and sums it digits. The function returns the sum back to the caller. 5. distinctSequence (int number): Given any positive integer n, the distinct sequence starting at n is obtained as follows. You write a sequence of numbers, one after another. Start by writing n. If n is even, then the next number is n/2. If n is odd, then the next number is 3n + 1. Continue in this way until you write the number 1. For example, The distinct sequence starting at 7 is (7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1), and it contains 17 numbers. The distinct sequence starting at 6 is (6, 3, 10, 5, 16, 8, 4, 2, 1), and the distinct sequence starting at 1 is (1). Program Run-1: Number Manipulations Enter a Positive integer Number > 0 Currency Calculation 19 cent/s is equivalent to: 0 TTTO 1 1 4 quarter/s dime/s nickel/s cent/s Age Calculation Assuming that you are 19 year's old, then You are 228 months old You are 6935 days old You are approximately 166440 hours old You are approximately 9986400 minutes old You are approximately 599184000 seconds old Separating digits for the integer 19 one nine. 19 19 Sum of its digits for the integer 19 10 The sequence of distinct numbers starting at 58 29 88 44 22 11 34 17 52 26 40 20 10 5 16 8 4 2 1 Implemented by Husain Gholoom April 29th, 2020 Program Run-2 Number Manipulations Enter a Positive integer Number > 0 ---> invalid input -1 *** Error re-run the app & use a positive number> 0 111 -1 19 is 13 Write a Python program that accepts a positive integer greater than zero from the keyboard. The program then calls the following functions : 1. currency Calculation (int number): Assuming that the number represent number of pennies, The function computes the number of quarters, dims, nickels, and pennies to be displayed. Displaying as many quarters as possible, then dims, then nickels, and pennies in that order. 2. personAge (int number): Assuming that the number represents a person's age. The function then calculates and displays statistics about the age. Assuming that there are 365 days in a year, The program displays the following information : - Number of months, numbers of days, number of hours, number of minutes, and number of seconds for the person. 3. numberSeparation (int number): Function should separate the numbers into its individual digits and displays on an screen the digits separated from one another by three spaces each. The function then displays each digit of the integer in English. For example, if the number is 42339, the output should be: 4 2 3 39. Four Two Three Three Nine 4. sumOfDigits (int number): A function that accepts the integer value that is entered from the keyboard and sums it digits. The function returns the sum back to the caller. 5. distinctSequence (int number): Given any positive integer n, the distinct sequence starting at n is obtained as follows. You write a sequence of numbers, one after another. Start by writing n. If n is even, then the next number is n/2. If n is odd, then the next number is 3n + 1. Continue in this way until you write the number 1. For example, The distinct sequence starting at 7 is (7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1), and it contains 17 numbers. The distinct sequence starting at 6 is (6, 3, 10, 5, 16, 8, 4, 2, 1), and the distinct sequence starting at 1 is (1). Program Run-1: Number Manipulations Enter a Positive integer Number > 0 Currency Calculation 19 cent/s is equivalent to: 0 TTTO 1 1 4 quarter/s dime/s nickel/s cent/s Age Calculation Assuming that you are 19 year's old, then You are 228 months old You are 6935 days old You are approximately 166440 hours old You are approximately 9986400 minutes old You are approximately 599184000 seconds old Separating digits for the integer 19 one nine. 19 19 Sum of its digits for the integer 19 10 The sequence of distinct numbers starting at 58 29 88 44 22 11 34 17 52 26 40 20 10 5 16 8 4 2 1 Implemented by Husain Gholoom April 29th, 2020 Program Run-2 Number Manipulations Enter a Positive integer Number > 0 ---> invalid input -1 *** Error re-run the app & use a positive number> 0 111 -1 19 is 13
Expert Answer:
Answer rating: 100% (QA)
Below is the Python program that fulfills the given requirements def currencycalculationnumber quart... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Referring to the figure and table of dimensions below, determine the following: i. (10 points) The absolute pressure of air trapped between the manometer fluid (SG = 0.83) and the mercury (p = 13,500...
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
Ivanhoe Company incurred research and development costs of $ 9 0 0 0 0 to develop a patent, and legal fees of $ 3 0 0 0 0 to register the patent. The patent has a legal life of 2 0 years and a useful...
-
The controller of Northwest Hardware has just received two forecasts for sales in the Montana District for the coming year. Based on an econometric analysis of consumer spending and economic trends,...
-
The fastest 10 percent of runners who complete the Nosy Neighbor 5K race win a gift certificate to a local running store. Assuming a normal distribution, how many standard deviations below the mean...
-
Suppose in its 2017 annual report that McDonald's Corporation reports beginning total assets of $28.46 billion, ending total assets of $30.22 billion, net sales of $22.74 billion, and net income of...
-
Locate sample affidavits used in a civil litigation for both California court and federal court. What do they have in common? Are there any striking differences?
-
The dollar cost of debt for Coval Consulting, a U.S. research firm, is 7.5%. The firm faces a tax rate of 30% on all income, no matter where it is earned. Managers in the firm need to know its yen...
-
Define pure securities. Are there pure securities traded in Toronto Stock Exchange and New York Stock Exchange? Why or why not? (2 marks) What is the definition of a complete market? Is the market...
-
The following questions are adapted from a variety of sources including questions developed by the AICPA Board of Examiners and those used in the Kaplan CPA Review Course to study long-term debt...
-
Solve the following differential equation using the Laplace transform. (y(0) = 1 ly' (0) = 3 where y" +9y = g(t) g(t) = (6, {o, ) 0t
-
Anthony decides to help his new niece attend a private college in 18 years. The projected cost of tuition, fees, and room and board when she starts amounts to $75,000 per year. How much should...
-
Define Press Release. Outline and briefly explain structure of a Press release.?
-
What are the main differences between a traditional press release and a social media press release, and what are the similarities?
-
The Jimmy Golf Company is a chain of golf shops. Its profit margin for 2020 is 8% (0.08); its total assets turnover ratio is 1.0; and its equity multiplier is 1.5. What is its return on common equity...
-
The goal is to determine the position of the block x (t) as a function of time in terms of w and init. It is known that a general solution for the displacement from equilibrium of a harmonic...
-
In July, 2014, the company paid a total of P120,000 for attorney's fees and other related costs. This was booked as organizational cost and included under other noncurrent assets to be amortized by...
-
Distinguish between the work performed by public accountants and the work performed by accountants in commerce and industry and in not-for-profit organisations.
-
In Listing 6.10, what advantage would there be in using character labels, such as a and c, instead of numbers for the menu choices and switch cases? Here is a sample run of the executive menu program...
-
What are the modules of C++ programs called?
-
Write a function that takes three arguments: the name of an int array, the array size, and an int value. Have the function set each element of the array to the int value.
-
Scott-Russel mechanism for generating straight line has (a) four lower kinematic turning pairs (b) two lower kinematic turning pairs and one lower kinematic sliding pairs (c) one lower kinematic...
-
The driving shaft of a Hooke's joint is rotating at a uniform speed of \(600 \mathrm{rpm}\). The speed of the driven shaft must be 575 and \(625 \mathrm{rpm}\). Determine the maximum permissible...
-
Define a steering gear.
Study smarter with the SolutionInn App