IV. Answer parts A,B, and C 4a) Return true if the letter 'a' occurs in the given...

60.1K

Verified Solution

Question

Programming

IV. Answer parts A,B, and C

4a)

Return true if the letter 'a' occurs in the given String, andfalse otherwise.


containsA(\"abc\") → true
containsA(\"wxyz\") → false
containsA(\"bcaca\") → true

4b)

Return true if the letter 'a' does not occur inthe given String, and false otherwise.


notContainsA(\"abc\") → false
notContainsA(\"wxyz\") → true
notContainsA(\"bcaca\") → false

4c)

Count the number of times a given char occurs in a given rangeof a String parameter (i.e. starting at a given start index, and upto but not including and end index). If end is greater than thelength of the String, then the method should stop looking at theend of the String.


countCharsInRange(\"java\", \"v\", 1, 2) → 0
countCharsInRange(\"java\", \"v\", 0, 2) → 0
countCharsInRange(\"java\", \"v\", 0, 3) → 1

Answer & Explanation Solved by verified expert
3.6 Ratings (435 Votes)
4apublic static boolean containsAString s return scontainsa 4bpublic static boolean notContainsAString s return scontainsa 4cpublic static int countCharsInRangeString s String ch int    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students