/*******************************************************************
 Name: Trevor Spalt
 Date: March 21, 2007
 Section: 2
 Lab: Lab 18
/*******************************************************************
 * This is the main driver. It will act as the dealer and fill use
 * the other classes to fill the players hands (deal). It will also
 * take in the players names, and finally give the output at the end
 * of the program.
 ******************************************************************/
 public class RecursionPlay
 {
   
	/*******************************************************************
 	* interative s uses a for loop to loop through the recursive problem
	* S(n) = 2 * S(n  1) for n  >= 2.
	*
	* @param n = the number that is brought in by the user
	* @return store = the number that comes from the iteration
 	******************************************************************/
	public static int interativeS(int n)
   {
		// store is defined as s(1) = 2
		int store;
		store = 2;
		
		// S(n) = 2 * S(n  1) for n  >= 2 is equal to the value
		// last set to the store variable so all I have to do is 
		// multiply 2 to store for however many times n.

		for(int counter = 2; counter <= n; counter++)
		{
			store = 2 * store;
		}// end for
		
		return store;
 	}// end interativeS
	
	/*******************************************************************
 	* recursive s uses recursion to loop through the recursive problem
	* S(n) = 2 * S(n - 1) for n  >= 2.
	*
	* @param n = the number that is brought in by the user
	* @return store = the number that comes from the iteration
 	******************************************************************/

	public static int recursiveS(int n)
   {
		// store is defined as s(1) = 2
		int store;
		
		if(n <= 1)
			store = 2;
		else
			store = 2 * recursiveS(n - 1);
			
		return store;
 	}
	
	/*******************************************************************
 	* recursive s uses recursion to loop through the recursive problem
	* T(n) = T(n - 1) + 3  for n >= 2 where T(1) = 1.
	*
	* @param n = the number that is brought in by the user
	* @return store = the number that comes from the iteration
 	******************************************************************/
	
	public static int recursiveT(int n)
   {
		// store is defined as T(1) = 1
		int store;
		
		if(n <= 1)
			store = 1;
		else
			store = 3 + recursiveT(n - 1);
			
		return store;
 	}
	
	/*******************************************************************
 	* recursive Multiply uses recursion to loop through the recursive
	* problem m(1) = m(n-1) + m for n >= 2 where m(1) = m.
	*
	* @param n = the number that is brought in by the user
	* @return store = the number that comes from the iteration
 	******************************************************************/
	
	public static int recursiveMultiply(int n, int m)
   {
		// store is defined as m(n) = m
		int store;
		final int MULTIPLIER = m;
		
		if(n <= 1)
			store = MULTIPLIER - n;
		else
			store = MULTIPLIER + (MULTIPLIER * recursiveMultiply(n - 1, MULTIPLIER));

		return store;
 	}
 }