Question: So far progress with the code. /* * To change this license header, choose License Headers in Project Properties. * To change this template file,

So far progress with the code.
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package esimatepie;
import java.util.Scanner;
/**
* Programmer: Charity Vincent
* Date: 09/28/2017
*/
public class EsimatePie {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner input = new Scanner(System.in);
System.out.print("Enter a value of n: ");
int n = input.nextInt();
System.out.printf("The estimated value of pie using %d terms is %.4f. ", n, pi(n));
}//end main
static double pi(int n)
{
double est_pi = 0;
int i;
for(i=1; i
est_pi += (double)Math.pow(-1, i+1)/(2*i - 1);
est_pi *= 4;
return est_pi;
}
}
3 5 79 11 2i-1 Write a method that returns m(i) for a given i and write a test program that displays the following table 3 1515 201 3.146 3.144 3.1441 3.1436 401 501 3.1433 3.1430 3.1428 .1427 701 801 901 Sample Output: Here is what your output should look like This program calculates the value of pi using the Gregory-Leibniz series 101 201 301 401 501 601 701 801 901 BUILD SUCCESSEUL (total time: 0 seconds) 4.0000 3.1515 3.1466 3.1449 3.1441 3.1436 3.1433 3.1430 3.1428 3.1427
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
