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....
-
On-time arrivals, lost baggage and customer complaints are three measures that are typically used to measure the quality of service being offered by airlines. Suppose that the following values...
-
Abercrombie & Fitch, once the favorite of loyal teens, is considering lowering prices on all items it sells in an effort to win them back after several years of sales declines. A&F's total sales were...
-
In February 2007, The Elliot Group, Inc., an Illinois real estate developer, made a deal with the Village of Arlington Heights to develop property in that village. Arlington Market, LLC, was...
-
Suppose AOL Time Warner, Inc., is having a bad year in 2011, as the company has incurred a $4.9 billion net loss. The loss has pushed most of the return measures into the negative column and the...
-
If V f(xz, y/z), prove that zV =xVx-yVy. =
-
Bonny Corp. has a defined benefit pension plan for its employees who have an average remaining service life of 10 years. The following information is available for 2013 and 2014 related to the...
-
Martin Motors purchased a machine on January 10, 2017 that will help diagnose problems with engines. The machine cost $210,000 and a residual value of $10,000 was anticipated, with a useful life of 5...
-
John, CPA, is evaluating the risk of material misstatement on an engagement. For each of the following, please indicate what effect the situation described would have on the affected risk component....
-
1. Rocket A leaves a space station with a speed of 0.54 c. Later, rocket B leaves in the same direction with a speed of 0.85 c. What is the velocity of rocket A as observed from rocket B? 2. Global...
-
Please review for accuracy and provide feedback if anything incorrect stands out. Stewart Burger is a forensic accountant who works for a large Houston CPA firm. His specialty is the investigation of...
-
I took advance gov and non profit accounting , strategic decision making and applied learning practicum courses in this semester. Reflect on the connection between knowledge concepts from the above...
-
Consider two parallel wires, each carrying an identical current I in the same direction. The moving charges create magnetic fields, and react to each other's magnetic fields, causing the wires to...
-
Gift loves the theatre; he considers himself as a theatregoer. He feels connected and sees it as a natural form of self-expression and creativity. The tables below show the number of tickets Gift...
-
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...
-
Which of the following is not an inherent part of Statement on Auditing Standards, No. 99/113? 1. Greater scrutiny of the chief executive and chief financial officers personal financial condition 2....
-
Which of the following statements best describes corporate governance with respect to fraud? 1. Auditors are primarily responsible for the detection of fraud, the Board of Directors for the...
-
Which of the following is not a reason that the prevention and detection of fraud resulting from management override and collusion presents a significant challenge for the antifraud community? 1....
Study smarter with the SolutionInn App