so I'm supposed to write a program, that does

pi = 4 - 4/3 + 4/5 - 4/7

and prints a table approximated by computing one or more terms ofthe series.

I'm limited to using do, while, for, and switch, and I suck at math so here's what I have so far.

Code:

import java.util.Scanner;
public class pi
{
public static void main( String args[] )
{
Scanner input = new Scanner( System.in);
double piNumber = 0.0;
int denom = 1;
int term;
int count = 0;
System.out.print( "Enter the times to calculate the term in the series: ");
term = input.nextInt();
if ( term < 1 )
term = 1;
for ( term = 1; term >= count ; count++ )
{
if (count % 2 == 0 )
{
piNumber -= 4 / denom;
}
else
{
piNumber += 4 / denom;
}
System.out.printf( "%.2f\n", piNumber );
}
}
}