StringRecursion - StringRecursion.java starter code by...

This preview shows page 1 - 2 out of 3 pages.

/* * StringRecursion.java * * starter code by: Computer Science 111, Boston University * * modified by: Mithali Shenoy * username: [email protected] * * A class that contains recursive methods that operate on strings. */ public class StringRecursion { /* * You may want to add test code for your methods to this * main method, although doing so is not required. * See the section of the assignment entitled * "Testing your methods". * * IMPORTANT: If your method does not return anything * (i.e., it is a void method), you should NOT try * to call it from within a println command. Instead, * you should call it on its own line -- for example: * printSeries(3, 8); */ public static void main(String[] args) { System.out.println("test 1 gives: " + numOccur('s', "Mississippi")); System.out.println("test 2 gives: " + numOccur('e', "Mississippi")); System.out.println("test 3 gives: " + removeVowels("Mississippi")); System.out.println("test 4 gives: " + removeVowels("apple")); } /* * numOccur - a recursive method that returns the number of times * that the character ch occurs in the String str.
Image of page 1

Subscribe to view the full document.

Image of page 2
  • Spring '13
  • DaveSullivan
  • Recursion, Mississippi, String str, null || str.equals

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern