Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

//CountMovieSpaces.java public class CountMovieSpaces { public static void main(String[]args) { //declare a string to read movie quote String movieQuote=They say that the best blaze burns

//CountMovieSpaces.java public class CountMovieSpaces { public static void main(String[]args) { //declare a string to read movie quote String movieQuote="They say that the best blaze burns brightest when circumstances are at their worst."; /*declare an integer and initialize to zero to count spaces.*/ int spaceCount=0; /*Iterate over the movieQuote string to find spaces.*/ for (int index = 0; index < movieQuote.length(); index++) { if(Character.isSpace(movieQuote.charAt(index))) //increment the count of spaceCOUNT by one spaceCount=spaceCount+1; } //print movie quote System.out.printIn("Movie Quote: "+movieQuote); //print spaces count System.out.printIn("Number of spaces in quote: "+spaceCount);

}

PLEASE HELP! I am not sure what I did wrong with this java code!

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

Essentials of Database Management

Authors: Jeffrey A. Hoffer, Heikki Topi, Ramesh Venkataraman

1st edition

133405680, 9780133547702 , 978-0133405682

More Books

Students also viewed these Databases questions

Question

=+Are you married?

Answered: 1 week ago