Question: Java Project Programming Help Please! Write a program that prompts for and reads in a string, then prints a message saying how many lower case
Java Project Programming Help Please!
Write a program that prompts for and reads in a string, then prints a message saying how many lower case x is in this string.
Your program should contain two methods: a main method reads in the string and a recursive (static) method countX that takes the string as input and returns the number of lowercase character x in this string. Make sure your method solves the problem using a recursive way, not a loop structure.
The following methods might be helpful, but you are not required to use all of them:
For a string s in Java,
s.length() returns the number of charaters in s
s.charAt(i) returns the ith character of s, 0-based
s.substring(i,j) returns the substring that starts with the ith character of s and ends with the j-1st character of s (not the jth), both 0-based.
So if s=happy, s.length=5, s.charAt(1)=a, and s.substring(2,4) = pp.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
