/** Lab 06. Writing recursive methods */
public class Rec {
    /** = number of times c occurs in s. */
    public static int numberc(char c, String s) {
        return 0;
    }
    
    /** = number of chars in s that are not c. */
    public static int numberNotc(char c, String s) {
        return 0;
    }

    /** = a copy of s but with all occurrences of c replaced by d. 
          Example: replace("abcabc", 'c', '$') = "ab$ab$" */
    public static String replace(String s, char c, char d) {
        return "";
    }
    
    /** = a copy of s with adjacent duplicates removed.
          Example: for s = "abbcccdeaaa", the answer is "abcdea".*/
    public static String rem1(String s) {
        return "";
    } 
    
    /** = a copy of s but with the FIRST occurrence of c removed (if present).
          Note: This can be done easily using indexOf. Don't do that.
          Do it recursively.*/
    public static String removeFirst(String s, char c) {
        return "";
    }

    /** = the reverse of s. e.g. rev("abc") is "cba".
          Do this one using this idea. The reverse of s of
          at least one char is the reverse of s[1..] catenated
          with s[0].
      */
    public static String rev1(String s) {
        return "";   
    }

    /** = the reverse of s. e.g. rev("abc") is "cba".
          Do this one using this idea. To reverse a string
          that contains at least 2 characters, switch the
          first and last ones and reverse the middle.
      */
    public static String rev2(String s) {
        return "";   
    }
    
   /** = the sum of the integers in s.
         Precondition: s contains at least one integer and
         has the form <integer>:<integer>:...:<integer>,
         and all the integers are positive (no - signs).
         Note that s contains no blanks 
         e.g. sumInts("34") = 34.
         e.g. sumInts("7:34:1:2:2") is 46. */
    public static int sumInts(String s) {
        return 0;
    }
    
    /** = n!, which is defined by
          0! = 1
          n! = n * (n-1)!  for n > 0
          Example: !5 = 5*4*3*2*1
          Precondition: n >= 0 */
    public static int fact(int n) {
        return 1;
    }

     /** = number of the digits in the decimal representation of n.
      e.g. numDigits(0) = 1, numDigits(3) = 1, numDigits(34) = 2. 
           numDigits(1356) = 4.
      Precondition: n >= 0. */
    public static int numDigits(int n) {
        return 0;
    }
   
    /** = sum of the digits in the decimal representation of n.
      e.g. sumDigits(0) = 0, sumDigits(3) = 3, sumDigits(34) = 7. 
      Precondition: n >= 0. */
    public static int sumDigits(int n) {
        return 0;
    }
    
    /** = the number of 2's in the decimal representation of n.
      e.g. number2(0) = 0, number2(2) = 1, number2(234252) = 3.
      Precondition: n >= 0. */
    public static int number2(int n) {
        return 0;
    }
    
    /** = The number of times that c divides n,
          e.g. into(5,3) = 0 because 3 does not divide 5.
          e.g. into(3*3*3*3*7,3) = 4.
          Precondition: n >= 1 and c > 1 */
    public static int into(int n, int c) {
        return 0;
    }  
    
    /** = Fibonnaci number F(n).
      Precondition: n ³ 0.
      Definition: F(0) = 0,
                  F(1) = 1, and
                  F(n) = F(n-1) + F(n-2) for n > 1.
      E.g. the first 10 Fibonnaci numbers are
           0, 1, 1, 2, 3, 5, 8, 13, 21, 34. */
    public static int Fib(int n) {
        return 0;
    }
    
    /** = b ** c, i.e. b multiplied by itself c times.
      Also called b "to the power" c.
      Precondition: c ³ 0
      Hints: b ** 0 = 1.
      if c is even, b**c == (b*b) ** (c/2)
      if c > 0, b**c =  b * (b ** (c-1)). */
    public static int exp(int b, int c) {
        return 0;
    }
    
    public static long number= 0;
    
    /** You know that each execution of a method call causes a frame to be created to
      hold information about the call --its parameters, local variables, the method name,
      the scope box, etc. On your computer, how many frames can be present at one time? To
      find out, in the interactions pane type these these lines, one at a time:
      
      Rec.number= 0;
      Rec.test();
      Rec.number
      
      Look at the body of test. From it, you can see that the number in static
      variable number is the number of calls made, and thus frames created, until
      there was "stack overflow". Write down that number somewhere.
      
      Then perform this test:
      
      Rec.number= 0;
      Rec.test(5);
      Rec.number
      
      Here, you are calling method test(int), which has one parameter. Compare the number
      of frames created here with the number created when calling method test(). Why is
      one bigger than another?
      */
    public static void test() {
        number= number + 1;
        test();
    }
    
    public static void test(int b) {
        number= number + 1;
        test(b);
    }
    
    public static void test(int b, int c) {
        int d, e, f, g, h, i, j, k, l, m, n, o, p, q, r,s, t, u, v, w, x, y, z;
        int d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, x1, y1, z1;
        d= 5;
        number= number + 1;
        test(b,c);
    }
 
    
}
