Provided Student Program for Lab19a

// Lab19ast.java

// Student Program Version

// This version completes recursive implementations of the

// , , , , , and

// the

methods.

public class Lab19st

{

public static void main(String args[])

{

System.out.println("Counting from 1 up to 10");

Test.countUp(1,10);

skip2();

System.out.println("Counting from 10 down to 1");

Test.countDown(10,1);

skip2();

System.out.print("The sum of all integers 0 to 100 are " + Test.sum(100));

skip2();

System.out.print("The factorial of 8 is " + Test.fact(8));

skip2();

System.out.print("The 10th Fibonacci Number is " + Test.fibo(10));

skip2();

System.out.print("The GCF of 120 and 108 is " + Test.gcf(120,108));

skip2();

System.out.print("2 raised to the 8th power is " + Test.pow(2,8));

skip2();

}

public static void skip2()

{

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

}

}

class Test

{

public static void countUp(int k, int n)

// displays consecutive integers from k to n

{

}

public static void countDown(int k, int n)

// displays consecutive integers backwards from k to n

{

}

public static int sum(int n)

// returns the sum of all integers 1 + 2 + .... + n-1 + n

{

}

public static int fact(int n)

// returns n factorial

{

}

public static int fibo(int n)

// returns the nth Fibonacci number

{

}

public static int gcf(int n1, int n2)

// returns the gcf of n1 and n2

{

}

public static int pow(int n1, int n2)

// returns n1 raised to the n2 power

{

}

}

80-Point and 100-Point Versions

The 100-point version requires the completion of all seven methods. The 80-point version requires only five methods. The gcf and the fibo methods are not required for the 80-point version.

Lab19a 80 Point Version One Required Output

Counting from 1 up to 10

1 2 3 4 5 6 7 8 9 10

Counting from 10 down to 1

10 9 8 7 6 5 4 3 2 1

The sum of all integers 0 to 100 are 5050

The factorial of 8 is 40320

2 raised to the 8th power is 256

Lab19a 100 Point Version

Counting from 1 up to 10

1 2 3 4 5 6 7 8 9 10

Counting from 10 down to 1

10 9 8 7 6 5 4 3 2 1

The sum of all integers 0 to 100 are 5050

The factorial of 8 is 40320

The 10th Fibonacci Number is 55

The GCF of 120 and 108 is 12

2 raised to the 8th power is 256