Course Solutions Uncategorized (Solved) : Create Program Prompt User Enter Three Different Quotes Use Loop Get Three Different Quote Q26470672 . . . .

(Solved) : Create Program Prompt User Enter Three Different Quotes Use Loop Get Three Different Quote Q26470672 . . . .

 

Create a program that Prompt the user to enter three differentquotes. *Use a loop to get these three different quotes (don’t justprompt three times). And display the total number of spacescontained in the String. Save the file as CountMovieSpaces2.java.Loop through the string and count the spaces.

String theQuote;
int stringLength;
stringLength = theQuote.length();
Once we have the length we can loop through the string with a forloop.
char ch = theQuote.charAt(i); //i is the index used in the forloop
You can now test that ch. if (ch == ‘ ‘) {
increment a variable such as numberOfSpaces
}
Sample output:
Enter a movie quote >> This is a quote from

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post