Formatted with Google Java Formatter

This commit is contained in:
github-actions
2021-09-22 16:29:51 +00:00
parent 2e586b7b3c
commit ce151a8bd8

View File

@ -1,11 +1,11 @@
package strings;
/**
* Vowel Count is a system whereby character strings are placed in order based on the
* position of the characters in the conventional ordering of an alphabet. Wikipedia:
* Vowel Count is a system whereby character strings are placed in order based on the position of
* the characters in the conventional ordering of an alphabet. Wikipedia:
* https://en.wikipedia.org/wiki/Alphabetical_order
*/
class CheckVowels{
class CheckVowels {
public static void main(String[] args) {
assert !hasVowels("This is a strings");
assert hasVowels("Hello World");
@ -20,8 +20,8 @@ class CheckVowels{
* @param input a string
* @return {@code true} if given string has vowels, otherwise {@code false}
*/
public static boolean hasVowels(String input){
if(input.matches("[AEIOUaeiou]")){
public static boolean hasVowels(String input) {
if (input.matches("[AEIOUaeiou]")) {
countVowels(input);
return true;
}
@ -30,15 +30,18 @@ class CheckVowels{
/**
* count the number of vowels
*
* @param input a string
* prints the count of vowels
* @param input a string prints the count of vowels
*/
public static void countVowels(String input){
public static void countVowels(String input) {
input.toLowerCase();
int count=0;
int i=0;
while(i<input.length()){
if(input.charAt(i)=='a' || input.charAt(i)=='e'||input.charAt(i)=='i'||input.charAt(i)=='o'||input.charAt(i)=='u' ){
int count = 0;
int i = 0;
while (i < input.length()) {
if (input.charAt(i) == 'a'
|| input.charAt(i) == 'e'
|| input.charAt(i) == 'i'
|| input.charAt(i) == 'o'
|| input.charAt(i) == 'u') {
count++;
}
i++;