Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I keep getting this error, error: cannot find symbol if(num== length) import java.util.*; public class Vowels { public static int countVowels(String s, int num, int

I keep getting this error,

error: cannot find symbol if(num== length)

import java.util.*; public class Vowels { public static int countVowels(String s, int num, int count) { int lenght= s.length(); if(num==length) return count; else { if (s.charAt(num)=='a'||s.charAt(num)=='A'|| s.charAt(num)=='e'||s.charAt(num)=='E'|| s.charAt(num)=='i'||s.charAt(num)=='I'|| s.charAt(num)=='o'||s.charAt(num)=='O'|| s.charAt(num)=='u'||s.charAt(num)=='U') count++; return countVowels(s,num+1,count); } } public static void main(String[]args) { String str; Scanner sc= new Scanner(System.in); System.out.println("check number of vowels:"); str=sc.nextLine(); int result,n=0,cnt=0; result=countVowels(str,n,cnt); System.out.println("Number of vowels"+result);} }

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

Spatial Databases A Tour

Authors: Shashi Shekhar, Sanjay Chawla

1st Edition

0130174807, 978-0130174802

More Books

Students also viewed these Databases questions

Question

How do Dimensional Database Models differ from Relational Models?

Answered: 1 week ago

Question

What type of processing do Relational Databases support?

Answered: 1 week ago

Question

Describe several aggregation operators.

Answered: 1 week ago