Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

class StringRecursion{ public static void main(String[] args){ System.out.println(howManyDigits(nBdj^19hb1^3j)); System.out.println(howManyDigits(Elementary data structures)); System.out.println(howManyDigits(H1Lolow2World !)); System.out.println(howManyDigits()); System.out.println(containsCapital(uteP)); System.out.println(containsCapital(abcba)); System.out.println(containsCapital(12#(1)b!nc!)); System.out.println(containsCapital(12#(1)b!nc!X)); } /** * Write a recursive method

image text in transcribed

class StringRecursion{ public static void main(String[] args){ System.out.println(howManyDigits("nBdj^19hb1^3j")); System.out.println(howManyDigits("Elementary data structures")); System.out.println(howManyDigits("H1Lolow2World !")); System.out.println(howManyDigits("")); System.out.println(containsCapital("uteP")); System.out.println(containsCapital("abcba")); System.out.println(containsCapital("12#(1)b!nc!")); System.out.println(containsCapital("12#(1)b!nc!X")); } /** * Write a recursive method to return number of digits a string * contains. * @param str * @return */ static int howManyDigits(String str){ // change the body of this method. return 0; } /** * Write a recursive method to find if a string contains * any capital letter (any letter between A-Z). * @param str * @return */ static boolean containsCapital(String str){ // change the body of this method. return true; } }
Complete the methods as described in the file StringRecursion.java. With correct code of the methods, the output of the program will be as follows. 4 0 2 0 true false false true

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2018 Dublin Ireland September 10 14 2018 Proceedings Part 1 Lnai 11051

Authors: Michele Berlingerio ,Francesco Bonchi ,Thomas Gartner ,Neil Hurley ,Georgiana Ifrim

1st Edition

3030109240, 978-3030109240

More Books

Students also viewed these Databases questions

Question

b. Will there be one assigned leader?

Answered: 1 week ago

Question

d. How will lack of trust be handled?

Answered: 1 week ago

Question

b. Does senior management trust the team?

Answered: 1 week ago