Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The static void main method will prompt the user to enter the text of a tweet using the prompt shown above in the sample run.
- The static void main method will prompt the user to enter the text of a tweet using the prompt shown above in the sample run.
- It will contain a value method countNumberSigns(tweetText) that will take a String tweetText containing the text of a tweet and return the number of '#' characters in the tweet.
- It will contain a value method countHashtags(tweetText) that will take a String tweetText containing the text of a tweet and return the number of hashtags in the tweet. A hashtag is defined precisely below, but it is basically a word starting with '#'. Words that have '#' somewhere after their start aren't hashtags unless they also start with '#'.
- The static void main method prints the number of hashtags and number signs found in the entered text as shown in the last line of output in each of the examples above.
- There are many ways to write the two methods in this program. However, this is a class where we are learning to program, and we need to not use the most powerful ways we might find via Google or other routes. The only way for which you will receive credit is to use a String traversal and process the String one character at a time.
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