Answered step by step
Verified Expert Solution
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
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started