III. Answer part A,B, and C. (in JAVA) 3a) Return the number of times the letter 'a'...

60.1K

Verified Solution

Question

Programming

III. Answer part A,B, and C. (in JAVA)

3a)

Return the number of times the letter 'a' occurs in aString.


countA(\"abc\") → 1
countA(\"wxyz\") → 0
countA(\"bcaca\") → 2

3b)

Return the number of times the given letter choccurs in the given String str.


countNumChar(\"abc\", \"a\") → 1
countNumChar(\"wxyz\", \"b\") → 0
countNumChar(\"bcaca\", \"c\") → 2

3c)

Count the number of characters that are either a or b in aString. Try to use only one for loop.

countAorB(\"abc\") → 2
countAorB(\"xyz\") → 0
countAorB(\"ab\") → 2

Answer & Explanation Solved by verified expert
4.1 Ratings (724 Votes)
public class    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