Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import java.util.Scanner; * This program counts the number of vowels in a sentence where the string * * For example, if the sentence string is

image text in transcribed

import java.util.Scanner; * This program counts the number of vowels in a sentence where the string * * For example, if the sentence string is "hello how are you" the number of vowels is: * * +7 (e, o, o, a, e, o, U) * */ public class CountVowels { public static void main(String[] args) { String sentence = "The quick brown fox jumps over the lazy dog"; J //-----------Start below here. To do: approximate lines of code = 1 // Create an integer variable called vowelcount and initialize it to a //---- -End here. Please do not remove this comment. Reminder: no changes outside the todo regions. //----- ---Start below here. To do: approximate lines of code = 9 // Write a for loop that counts from 0 to the length-1 of the string variable sentence (see above) // Inside the loop use the charAt() method of the String class and check if the current character of the sentence is a vowel. // If it is, increment vowelCount by 1 // A vowel is defined as one of the following characters 'a' 'e' i 'A 'E! 'I' 'Y' //---- --End here. Please do not remove this comment. Reminder: no changes outside the todo regions. System.out.println("Vowel Count = + vowelCount); System.out.println("Expected: "); System.out.println("Vowel Count = + 12)

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

Database And Expert Systems Applications 19th International Conference Dexa 2008 Turin Italy September 2008 Proceedings Lncs 5181

Authors: Sourav S. Bhowmick ,Josef Kung ,Roland Wagner

2008th Edition

3540856536, 978-3540856535

More Books

Students also viewed these Databases questions