/** 
* 
*  This class generates words in the language of an alien race 
*  Problem comes from Lewis and Loftus Chapter 11 - #11.7
*
*  @author Elizabeth Adams
*  @version 0
*/
public class P5V0
{
   
  private String blurb;


    /**
	 * 
	 * Explicit constructor
	 *
	 */
    public P5V0()
	 {
	    blurb = "x";
		 
	 }// end constructor

    /**
	 *  constructs a Whatzit which is a 'q' followed by
	 *  either a 'z' or a 'd' followed by a whoozit
	 *
	 *  @param 0 if qd, 1 if qz
	 *  @return qd or qz
	 * 
	 */
	 public String whatzit (int zd)
	 {
	     String  answer;
	     if (zd == 0)
		     answer = "qd";
		  else
		     answer = "qz";
		  return answer;
	 }
	 
	 /**
	 *  This recursive method generates a whoozit which is 
	 *  an 'x' followed by string of 0 or more 'y's
	 *
	 *  @param the number of 'y's in the string
	 *  @return a string of x followed by 0 or more 'y's
	 *
	 */
	 public String whoozit(int numberYs)
	 {
	    String answer;
		 
	    answer = "";
	    answer = blurb + wise(numberYs);
		 return answer;
	 }	 
	 
	 /**
	 *  retursive method returns a string of 0 or more 'y's
	 *
	 *  @param number of 'y's to be generated
	 *  @return string of 0 or more 'y's
	 *
	 */
	 private String wise (int howManyMore)
	 {	     		  		  
	     if (howManyMore == 0)
		     return "";
		  else
		     return "y" + wise(howManyMore-1);
	 } // end wise

}// end P5V0	 