Question: OBJECTIVES . Read data from the keyboard. Implement a for loop to aproximate t. Display information in a user-friendly format PROGRAM DESCRIPTION Write a program

OBJECTIVES . Read data from the keyboard. Implement a for loop to aproximate t. Display information in a user-friendly format PROGRAM DESCRIPTION Write a program to display an approximation of pi. The series for the inverse tangent function, which is also known as Gregory's series, can be given by: The Madhava-Leibniz series is a special case of a more general series expansion for the inverse tangent function. tan-1 1 = 1-t Note that, tanT-1, hence tan-11therefore Resulting in series that can be used to approximate pi, albeit very slowly PROGRAM SPECIFICATIONS 1. Create a class called PiApproximation 2. Consider the following code public static void main(Stringt] args) int n; /Number maxinum of terms on the Madheva-Leibniz int nMax28; double piseries -8; /Initial value for the approxination s deals with alternating sien on terns boolean positiveTerm true; Loop control variable if (pasitiveTerm) piseries piSeries 1.8 positiveTernafalse piseries piSeries 1.8 positiveTern-true s Conpute and display the approximation for pi 3. Complete the code and modify it to read from the keyboard the number of terms in the series used to approximate pi. That is, the variable nMax should be read fr 4. Sample output: This programs uses the Madhava-Leibniz series to approximate the value of pi Please enter how many terms of the series you want to use: 283 pi is approxinatelly3.136592684839816 using 288 terns of the series Coding Standards: 1. Remove the comments generated by NetBeans. 2. Write a comment that includes your name and the date of your last revision. In addition, write comments that explain the contents of your code. 3. Upload your completed .java file to Canvas
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
