I need to design class hierarchy which has a super-class Pythagoras and two sub-classes (Vieta and Wallis), which can be used to produce estimates of PI, using either the method proposed by Vieta or that of Wallis. The only input by the user is a "number of terms"

Vieta's method:

2/Pi = SQRT(2)/2 *sqrt(2+sqrt(2))/2 *sqrt(2+sqrt(2+sqrt(2)))/2 etc etc

Wallis's method:

PI/2 = 2/1 * 2/3 * 4/3 * 4/5 etc

i know this requires a sort of loop construct but am having difficulty writing the methods for the two directions of the loop....here's my code can anyone help?

/****************************************************/

/* */

/* PYTHAGORAS CLASS */

/* */

/****************************************************/

class PythagorasClass {

//----------------------------FIELDS-----------------------------

private int numberOfTerms;

private int firstTerm;

//----------------------------CONSTRUCTORS-----------------------

/* Constructor */

public PythagorasClass (int numN, int fTerm) {

numberOfTerms = numN;

firstTerm = fTerm;

}

/****************************************************/

/* */

/* VIETA CLASS */

/* */

/****************************************************/

class VietaClass extends PythagorasClass {

//----------------------------FIELDS------------------------------

private static double sqrt;

private static double (sqrt + 2);

private double variable1 = 0;

private double variable2 = 0;

//---------------------------CONSTRUCTORS-------------------------

public VietaClass (int numN, int fTerm) {

super(numN, fTerm);

}

//--------------------------METHODS-------------------------------

/* Output terms method */

public void outputTerms() {

int loopParameter;

final int START_CONDITION = 0;

for(loopParameter = START_CONDITION;

loopParameter < numberOfTerms;loopParameter++)

System.out.print(WHAT TO PUT HERE?); <<<<<<<<<<

System.out.print("\n\n");

}

/****************************************************/

/* */

/* WALLIS CLASS */

/* */

/****************************************************/

class WallisClass extends PythagorasClass {

//---------------------------FIELDS-------------------------------

private static double 1;

private static double 2;

private static double 3;

private static double 4;

private static double 5;

private double variable1 = 0;

private double variable2 = 0;

//--------------------------CONSTRUCTORS---------------------------

public WallisClass (int numN) {

super(numN);

//--------------------------METHODS--------------------------------

}

}

PS - if someone can solve this email me @ fatboyfat63@hotmail.com and I shall reward you with paypal!