MATH 21 SPRING 2019 Part III: Answer ALL questions in this section. Each question is worth...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
MATH 21 SPRING 2019 Part III: Answer ALL questions in this section. Each question is worth 5 points. 11. Compute: 12345+ 43215 12. Compute: 10012+ 10112 13. Compute: 2356 + 1346 14. Compute: 7689 +2819 15. Compute: 11002-10112 16. Compute: 4007-3667 17. Compute: 7658-6778 BCC 1. This problem considers two ways to compute x" for some n 0. a. Write an iterative method powerl to compute x" for n 0. b. Write a recursive method power2 to compute x" by using the following recursive formulation: xo=1 x = x* x-1 if n>0 c. Write an accompanying main method which invokes both power1 and power2 for increasing values of n = 0 up to n = 10. For the purpose of this exercise, give x a fixed value of 2.0 and change only the value of n. You probably want to change the value of n in a loop, as I have done in my solution to this exercise. Here is an example test run of the main method I wrote to solve this exercise: 2.0 0 1.0 computed iteratively. 2.0^0 1.0 computed recursively. 2.0^1 2.0 computed iteratively. 2.0^1 2.0 computed recursively. 2.0 24.0 computed iteratively. 2.0 24.0 computed recursively. 2.0 3 8.0 computed iteratively. 2.0 3 8.0 computed recursively. 2.0 4 16.0 computed iteratively. 16.0 computed recursively. iteratively. 2.0 4 2.0 5 32.0 computed 2.0^5 32.0 computed recursively. 2.0^6=> 64.0 computed iteratively. 2.0^6 2.0 7 = 64.0 computed recursively. 128.0 computed iteratively. 2.0 7 128.0 computed recursively. 256.0 computed iteratively. 2.0 8 2.0^8 256.0 computed recursively. 2.0^9 512.0 computed iteratively. 512.0 computed recursively. 2.0^9 2.0 10 1024.0 computed iteratively. 2.0^10 1024.0 computed recursively. Notice that all of the computed values are identical, but power1 computes its value using a loop, and power2 computes its value by means of recursion (5 points). MATH 21 SPRING 2019 Part III: Answer ALL questions in this section. Each question is worth 5 points. 11. Compute: 12345+ 43215 12. Compute: 10012+ 10112 13. Compute: 2356 + 1346 14. Compute: 7689 +2819 15. Compute: 11002-10112 16. Compute: 4007-3667 17. Compute: 7658-6778 BCC MATH 21 SPRING 2019 Part III: Answer ALL questions in this section. Each question is worth 5 points. 11. Compute: 12345+ 43215 12. Compute: 10012+ 10112 13. Compute: 2356 + 1346 14. Compute: 7689 +2819 15. Compute: 11002-10112 16. Compute: 4007-3667 17. Compute: 7658-6778 BCC MATH 21 SPRING 2019 Part III: Answer ALL questions in this section. Each question is worth 5 points. 11. Compute: 12345+ 43215 12. Compute: 10012+ 10112 13. Compute: 2356 + 1346 14. Compute: 7689 +2819 15. Compute: 11002-10112 16. Compute: 4007-3667 17. Compute: 7658-6778 BCC 1. This problem considers two ways to compute x" for some n 0. a. Write an iterative method powerl to compute x" for n 0. b. Write a recursive method power2 to compute x" by using the following recursive formulation: xo=1 x = x* x-1 if n>0 c. Write an accompanying main method which invokes both power1 and power2 for increasing values of n = 0 up to n = 10. For the purpose of this exercise, give x a fixed value of 2.0 and change only the value of n. You probably want to change the value of n in a loop, as I have done in my solution to this exercise. Here is an example test run of the main method I wrote to solve this exercise: 2.0 0 1.0 computed iteratively. 2.0^0 1.0 computed recursively. 2.0^1 2.0 computed iteratively. 2.0^1 2.0 computed recursively. 2.0 24.0 computed iteratively. 2.0 24.0 computed recursively. 2.0 3 8.0 computed iteratively. 2.0 3 8.0 computed recursively. 2.0 4 16.0 computed iteratively. 16.0 computed recursively. iteratively. 2.0 4 2.0 5 32.0 computed 2.0^5 32.0 computed recursively. 2.0^6=> 64.0 computed iteratively. 2.0^6 2.0 7 = 64.0 computed recursively. 128.0 computed iteratively. 2.0 7 128.0 computed recursively. 256.0 computed iteratively. 2.0 8 2.0^8 256.0 computed recursively. 2.0^9 512.0 computed iteratively. 512.0 computed recursively. 2.0^9 2.0 10 1024.0 computed iteratively. 2.0^10 1024.0 computed recursively. Notice that all of the computed values are identical, but power1 computes its value using a loop, and power2 computes its value by means of recursion (5 points). 1. This problem considers two ways to compute x" for some n 0. a. Write an iterative method powerl to compute x" for n 0. b. Write a recursive method power2 to compute x" by using the following recursive formulation: xo=1 x = x* x-1 if n>0 c. Write an accompanying main method which invokes both power1 and power2 for increasing values of n = 0 up to n = 10. For the purpose of this exercise, give x a fixed value of 2.0 and change only the value of n. You probably want to change the value of n in a loop, as I have done in my solution to this exercise. Here is an example test run of the main method I wrote to solve this exercise: 2.0 0 1.0 computed iteratively. 2.0^0 1.0 computed recursively. 2.0^1 2.0 computed iteratively. 2.0^1 2.0 computed recursively. 2.0 24.0 computed iteratively. 2.0 24.0 computed recursively. 2.0 3 8.0 computed iteratively. 2.0 3 8.0 computed recursively. 2.0 4 16.0 computed iteratively. 16.0 computed recursively. iteratively. 2.0 4 2.0 5 32.0 computed 2.0^5 32.0 computed recursively. 2.0^6=> 64.0 computed iteratively. 2.0^6 2.0 7 = 64.0 computed recursively. 128.0 computed iteratively. 2.0 7 128.0 computed recursively. 256.0 computed iteratively. 2.0 8 2.0^8 256.0 computed recursively. 2.0^9 512.0 computed iteratively. 512.0 computed recursively. 2.0^9 2.0 10 1024.0 computed iteratively. 2.0^10 1024.0 computed recursively. Notice that all of the computed values are identical, but power1 computes its value using a loop, and power2 computes its value by means of recursion (5 points). 1. This problem considers two ways to compute x" for some n 0. a. Write an iterative method powerl to compute x" for n 0. b. Write a recursive method power2 to compute x" by using the following recursive formulation: xo=1 x = x* x-1 if n>0 c. Write an accompanying main method which invokes both power1 and power2 for increasing values of n = 0 up to n = 10. For the purpose of this exercise, give x a fixed value of 2.0 and change only the value of n. You probably want to change the value of n in a loop, as I have done in my solution to this exercise. Here is an example test run of the main method I wrote to solve this exercise: 2.0 0 1.0 computed iteratively. 2.0^0 1.0 computed recursively. 2.0^1 2.0 computed iteratively. 2.0^1 2.0 computed recursively. 2.0 24.0 computed iteratively. 2.0 24.0 computed recursively. 2.0 3 8.0 computed iteratively. 2.0 3 8.0 computed recursively. 2.0 4 16.0 computed iteratively. 16.0 computed recursively. iteratively. 2.0 4 2.0 5 32.0 computed 2.0^5 32.0 computed recursively. 2.0^6=> 64.0 computed iteratively. 2.0^6 2.0 7 = 64.0 computed recursively. 128.0 computed iteratively. 2.0 7 128.0 computed recursively. 256.0 computed iteratively. 2.0 8 2.0^8 256.0 computed recursively. 2.0^9 512.0 computed iteratively. 512.0 computed recursively. 2.0^9 2.0 10 1024.0 computed iteratively. 2.0^10 1024.0 computed recursively. Notice that all of the computed values are identical, but power1 computes its value using a loop, and power2 computes its value by means of recursion (5 points).
Expert Answer:
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-6. On December 12, Irene purchased the building where her store is located. She paid...
-
Evaluate double integeral x^2 dydx, where R is the two dimensional region bounded by the curves y=x & y=x^2.
-
Prepare journal entries for each of the following transactions: 1. Purchase equipment in exchange for cash of $22,400. 2. Provide services to customers and receive cash of $5,100. 3. Pay the current...
-
Fred's Inc. operates general merchandise retail discount stores and full-service pharmacies in the Southeastern United States. Access the company's 10-K for the fiscal year ended February I. 2014....
-
As a team, consider a retail store, Emerys Cookies, that makes and sells cookies. The job basically requires people to make cookies, wash dishes and clean, and interact with customers. a. How could...
-
Angela Rodriguez practices law under the business title Angela Rodriguez Attorney at Law, Inc. During June, her law practice engaged in the following transactions: Rodriguezs business uses the...
-
After operating for several months, architect Mark Meecham completed the following transactions during the latter part of January: Journalize the transactions of Mark Meecham, Architect. Include an...
-
Reflect on only one (1) of the following: "PMI": PMI identifies a number of Process Groups, Knowledge Areas and individual Processes. Which ones seem the most critical or the most demanding or the...
-
Alice has invented a new card game to play with Bob. Alice made a deck of cards with random values between 1 and 52. Bob picks 5 cards. Then, he has to rearrange the cards so that by utilizing the...
-
Thebe Corp. ' s CFO provides you with the following information: there are 5 0 0 , 0 0 0 shares of stock which current price is 1 5 , 6 5 euros and which beta is 1 , 7 8 . The balance sheet shows 4 ,...
-
Look for one of the nine Goals that Apple has not adequately addressed in its Packaging Strategy. Prepare a brief description of the goal, focusing on why you think Apple has not addressed it and how...
-
Considering transformational leadership, authentic leadership, servant leadership, adaptive leadership, and inclusive leadership discussions, what style(s) has Bezos demonstrated in the case? Please...
-
On April 30th, Future Mart issued a $10,000, 12-month, 4% note to settle an outstanding account receivable. The interest and the principal will be due on May 1st of next year. Future Mart's year-end...
-
Let's consider the inventory problem with quantity discounts. The parameters are as follows: Annual demand lambda = 25000, Order cost K = 100, I = 0.3. For order quantities between 0 and 499, you pay...
-
Do you believe either Bitcoin or Gold, or neither, would serve as a good form of money in today's world? Explain your reasoning. It is important to clearly state your selection and the reasons why...
-
Find the end points of the minor and major axis for the graph of the ellipse (x-4) 9 (y-4) 36 Maximum point on the major axis: Minimum point on the major axis: Maximum point on the minor axis:...
-
Do animals have rights? If so, what are they? What duties do human beings have toward animals? Does KFC protect animal welfare at an acceptable level?
-
Abigail (Abby) Boxer is a single mother working as a civilian accountant for the U.S. Army. Her Social Security number is 676-73-3311 and she lives at 3456 Alamo Way, San Antonio, TX 78249. Helen,...
-
Ken paid the following amounts for interest during 2012: Qualified interest on home mortgage...........................................$4,700 Auto loan...
-
Please answer the following questions regarding the taxability of Social Security: a. A 68-year-old taxpayer has $20,000 in Social Security income and $100,000 in tax-free municipal bond income. Does...
-
Is the color of a smartphone nominal or ordinal?
-
A pollster wants to estimate the proportion of voters in a certain town who are Democrats. He goes to a large shopping mall and approaches people to ask whether they are Democrats. Is this a simple...
-
Provide an example of a qualitative variable and an example of a quantitative variable.
Study smarter with the SolutionInn App