Create a new C++ project titled CIS22A Lab 5 in the CodeBlocks IDE. Use the Console...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Create a new C++ project titled "CIS22A Lab 5" in the CodeBlocks IDE. Use the "Console Application project option. Use loop to approximate the Pl value In the 14th century, Babylonian mathematicians approximated the value of PI manually by calculating this series: √12 (1-3-3) + Each term in the series has this common pattern: √12 x 1/(m x3") where m is 1, 3, 5, 7......... and n is 0, 1, 2, 3, 4....... 1 1 5.32 7.33 The first term in the series has the value √12 where m is 1 and n is 0. √12 * The second term has the following value, where m is 3 and n is 1: -1 3x3 ...) Notice that the signs of each term alternate between + and - The program should ask user to enter the number of terms (termCount) for the series. The program then iterates termCount times to estimate the PI value and display it. The larger the input termCount is, the more accurate the value of estimated Pl is. Topic: Use of any loop statement (chapter 5). There is NO need to use any "if/else" statement. https://docs.google.com/document/d/1zbSZh6ldyge7lauROojEfg0_slyCPYXCEXL8tz2iht0/edit?usp=sharing You should use an input validation loop to ensure that user enters a value of termCount that is greater than 0. If user enter a count that is less than 0, keep asking for another input. The program should display the estimated Pl value with 15 decimal digits in the fractions. You should use the square root function and power function in the "cmath" library. You should also display the value of the M_PI constant in the C++ "cmath" library with 15 decimal fraction digits after decimal point. Displaying both the calculated value and the C++ M_PI constant provides an easy way to compare and see the difference. Here are sample outputs: This program estimates the value of PI using the Babylonian method. Enter a count that will be used for series iteration: 1 1 3.464101615137754 Estimated PI with 15 decimal fraction digits is 3.464101615137754 PI value in the cmath library is 3.14159265 35 89793 Process returned 0 (0x0) execution time: 2.595 s Press any key to continue. This program estimates the value of PI using the Babylonian method. Enter a count that will be used for series iteration: 10 1 3.464101615137754 2 3.079201435 678004 3 3.156181471569954 4 3.137852891595680 5 3.142604745663084 6 3.141308785462883 7 3.141674312698837 8 3.1415687159 9 3.141599773811505 10 3.141590510938080 84 Estimated PI with 15 decimal fraction digits is 3.141590510938080 PI value in the cmath library is 3.141592653589793 Process returned 0 (0x0) Press any key to continue. execution time: 11.348 s Create a new C++ project titled "CIS22A Lab 5" in the CodeBlocks IDE. Use the "Console Application project option. Use loop to approximate the Pl value In the 14th century, Babylonian mathematicians approximated the value of PI manually by calculating this series: √12 (1-3-3) + Each term in the series has this common pattern: √12 x 1/(m x3") where m is 1, 3, 5, 7......... and n is 0, 1, 2, 3, 4....... 1 1 5.32 7.33 The first term in the series has the value √12 where m is 1 and n is 0. √12 * The second term has the following value, where m is 3 and n is 1: -1 3x3 ...) Notice that the signs of each term alternate between + and - The program should ask user to enter the number of terms (termCount) for the series. The program then iterates termCount times to estimate the PI value and display it. The larger the input termCount is, the more accurate the value of estimated Pl is. Topic: Use of any loop statement (chapter 5). There is NO need to use any "if/else" statement. https://docs.google.com/document/d/1zbSZh6ldyge7lauROojEfg0_slyCPYXCEXL8tz2iht0/edit?usp=sharing You should use an input validation loop to ensure that user enters a value of termCount that is greater than 0. If user enter a count that is less than 0, keep asking for another input. The program should display the estimated Pl value with 15 decimal digits in the fractions. You should use the square root function and power function in the "cmath" library. You should also display the value of the M_PI constant in the C++ "cmath" library with 15 decimal fraction digits after decimal point. Displaying both the calculated value and the C++ M_PI constant provides an easy way to compare and see the difference. Here are sample outputs: This program estimates the value of PI using the Babylonian method. Enter a count that will be used for series iteration: 1 1 3.464101615137754 Estimated PI with 15 decimal fraction digits is 3.464101615137754 PI value in the cmath library is 3.14159265 35 89793 Process returned 0 (0x0) execution time: 2.595 s Press any key to continue. This program estimates the value of PI using the Babylonian method. Enter a count that will be used for series iteration: 10 1 3.464101615137754 2 3.079201435 678004 3 3.156181471569954 4 3.137852891595680 5 3.142604745663084 6 3.141308785462883 7 3.141674312698837 8 3.1415687159 9 3.141599773811505 10 3.141590510938080 84 Estimated PI with 15 decimal fraction digits is 3.141590510938080 PI value in the cmath library is 3.141592653589793 Process returned 0 (0x0) Press any key to continue. execution time: 11.348 s
Expert Answer:
Answer rating: 100% (QA)
Here is your required code for your program Now we will discuss it Here is the editable version of t... View the full answer
Related Book For
Systems Analysis and Design
ISBN: 978-1285171340
10th edition
Authors: Shelly Cashman, Harry J. Rosenblatt
Posted Date:
Students also viewed these programming questions
-
Create a VB application that lets the user enter his or her weight (in pounds) and height (in inches). If the user fails to enter numeric values, display an appropriate error message and do not...
-
Century Lab plans to purchase a new centrifuge machine for its Manitoba facility. The machine costs $137,500 and is expected to have a useful life of eight years, with a terminal disposal value of...
-
Create the following vector A. A = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18] Then using the MATLAB's built-in reshape function create the following matrix B from the vector A: By writing one...
-
Suppose that triangle ABC is a right triangle with a right angle at C and hypotenuse c. Also note that a is the length of the side opposite angle A and b is the length of the side opposite angle B....
-
How has Method identified customer relationships with the organization? What does the company do to nurture those relationships?
-
Consider the octahedral [NiF 6 ] 3 ion. What spin state and magnetic moment could it have? How would the Jahn-Teller effect affect the two spin states, and how might this complicate an interpretation...
-
Recording Purchase and Sales Transactions} Raymond Company and Geeslin Company both use a perpetual inventory system. The following transactions occurred during the month of January: Jan. 1 Raymond...
-
Amortization schedule for bonds. On January 1, 2008, Seward Corporation issues $100,000 face value, 8% semiannual coupon bonds maturing three years from the date of issue. The coupons, dated for June...
-
i Teledex Company manufactures products to customers' specifications and uses job - order costing. The c predetermined overhead rate based on direct labor cost to apply manufacturing overhead (...
-
Cherry Cotta makes custom ordered clay pots for residential gardens. Below is cost information regarding its latest job. a. Materials were purchased on account. $18,996 purchased b. A materials...
-
CHAPTER 7 PROBLEM ONE LISA Corporation has an activity-based costing system with three activity cost pools--Processing, Setting Up, and Other. The company's overhead costs consist of equipment...
-
WhiletheDallas Cowboys have won five Super Bowls, many football fans recognizetheteam for its futuristic home,AT&TStadiumin Arlington, Texas.The80,000-seatstadium, built in 3 years, features two...
-
Exercise 4-16 Karen Company produces two types of food processors. Information about the two product lines for 2021 is as follows: Selling price per unit Variable cost per unit CM per unit Regular...
-
In atleast 1000 words Mini-case study Disney Few companies have been able to connect with their audience as well as Disney has. Since its founding in 1923, the Disney brand has been synonymous with...
-
Various defects are observed for a product of an microchip over of a period and frequencies are listed. Identify the areas the company to focus and to improve with the concept of Pareto. 1. Ending...
-
Beginning inventory consisted of 1,000 units with costs of P7,000. All materials and 60 percent of labor and overhead were added in the prior period. In addition, another 8,000 units were started and...
-
The Awesome Toy Company s R&D department is always looking for great ideas for new toys. On average, the R&D department generates about 3 0 ?new toy ideas a week. To go from idea to approved product,...
-
The power company must generate 100 kW in order to supply an industrial load with 94 kW through a transmission line with 0.09 resistance. If the load power factor is 0.83 lagging, find the...
-
What fact-finding methods are well-suited for complex technical issues? Which might be appropriate for the pursuit of new, cutting-edge features?
-
What techniques can help e-mail communications? Provide specific examples.
-
1. Should Paperback Press have a specific process to manage future changes and enhancements? What should it be? 2. If new features are added, what methodology should the IT staff use to add functions...
-
Identify the main users of accounting information for a university. For what purposes would different user groups need information? Would these groups use the accounting information in a different...
-
List the seven steps in the accounting cycle in the order in which they occur and explain what occurs at each step of the accounting cycle. LO18
-
Identify each of the following categories of accounts as temporary or permanent: assets, liabilities, equity, revenues, expenses, dividends declared. How is the distinction between temporary and...
Study smarter with the SolutionInn App