Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a program that analyzes the vowels in a character string. Define a null-t

ID: 3797575 • Letter: C

Question


Create a program that analyzes the vowels in a character string. Define a null-terminated string of alphanumerical characters. For example: "In phanetics, a vowel is a sound in spoken language, such as an English ah!or oh!, pronounced with an open vocal tract". The program has to have the following subroutines: only for ARM200: a printing subroutine that prints the entry and resulting string a subroutine that takes a character and analyzes wheth the character is a vowel. If the character is a vowel, converts the vowel in uppercase and increments a count of vowels. A main subroutine in sequence: only for ARM200: first prints the original string calls the subroutine that parses the string for every character calls the subroutine for vowel analysis replaces the received character back in the string only for ARM200 at the end prints the resulting string and the count of the vowels.

Explanation / Answer

VowelAnalysis.java :

package org.chegg;

import java.util.Scanner;

public class VowelAnalysis {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

System.out.println("Enter string:");

String str = sc.next();

int count = 0 ;

StringBuffer sb = new StringBuffer();

onlyforARM200(str);

for(int i=0;i<str.length();i++){

boolean flag = vowelFinding(str.charAt(i));

if(flag){

sb.append(Character.toUpperCase(str.charAt(i)));

count++;

}

else

sb.append(str.charAt(i));

}

String result = sb.toString();

onlyforARM200(result);

System.out.println("Number of vowels in a string:"+count);

}

public static void onlyforARM200(String s){

System.out.println(s);

}

public static boolean vowelFinding(char ch){

String vowel = "aeiou";

boolean f = false;

for(int j=0;j<vowel.length();j++)

if(ch==vowel.charAt(j)){

f = true;

break;

}

return f;

}

}

sampleInput & output:

Enter string:

lakeshmaeonionrao// given string

lakeshmaeonionrao// original string

lAkEshmAEOnIOnrAO//result string

Number of vowels in a string:9

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote