(Solved) : Using Java Programming Language Calculate Value Pi Infinite Series Pi 4 4 3 4 5 4 7 4 9 4 Q43923906 . . .
Using the Java programming language, calculate the value of pifrom the infinite series pi = 4 – 4/3 + 4/5 – 4/7 + 4/9 – 4/11 +… Print a table that shows the value of pi approximated bycomputing one term of this series, by two terms, by three terms,and so on. Use default precision for output (i.e. do not set anydecimal precision). Start by asking the user how many terms of theseries to compute to, and then let the user enter the information.Use this to print a table of the first N terms of the series (whereN is the data entered by the user). Assume the user’s input will bea non-negative integer. (see sample output)
Sample Run (Sample user input is bolded)
Exercise 5.20: ‘Approximating PI’
Compute to how many terms of the series? 20terms
PI approximation
1 4.0
2 2.666666666666667
3 3.466666666666667
4 2.8952380952380956
5 3.3396825396825403
6 2.9760461760461765
7 3.2837384837384844
8 3.017071817071818
9 3.2523659347188767
10 3.0418396189294032
11 3.232315809405594
12 3.058402765927333
13 3.2184027659273333
14 3.0702546177791854
15 3.208185652261944
16 3.079153394197428
17 3.200365515409549
18 3.0860798011238346
19 3.1941879092319425
20 3.09162380666784
Expert Answer
Answer to Using the Java programming language, calculate the value of pi from the infinite series pi = 4 – 4/3 + 4/5 – 4/7 + 4/9 -…
OR