-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCheck.java
More file actions
40 lines (38 loc) · 771 Bytes
/
Check.java
File metadata and controls
40 lines (38 loc) · 771 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import java.util.*;
public class Check
{
String str;
int w;
void InputString()
{
Scanner as = new Scanner(System.in);
System.out.print("\t\t INPUT \n\nEnter the Sentence:");
str=as.nextLine();
str=" "+str;
w=0;
}
void counter(int n)
{
if(n<str.length())
{
char c=str.charAt(n);
if((c=='A' || c=='E' || c=='I' || c=='O' || c=='U')&& str.charAt(n-1)==' ')
w++;
counter(++n);
}
else
return;
}
void Disp()
{
counter(0);
System.out.println("\n\t \t THE OUTPUT:");
System.out.println("\nThe Sentence:"+str+" has total "+w+" word(s) starting with Capital Vowels.");
}
public static void main(String args[])
{
Check word=new Check();
word.InputString();
word.Disp();
}
}