0% found this document useful (0 votes)
24 views1 page

String Texto

The document contains code that takes in a phrase from the user, splits it into individual letters and words, counts the number of vowels, replaces the vowels with numbers, and outputs the new phrase along with the word and vowel counts.

Uploaded by

Adrian Hermosa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views1 page

String Texto

The document contains code that takes in a phrase from the user, splits it into individual letters and words, counts the number of vowels, replaces the vowels with numbers, and outputs the new phrase along with the word and vowel counts.

Uploaded by

Adrian Hermosa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

{

String texto, resp="";

int cont=0;

String nf [];

String nv [];

String v []= {"a","e","i","o","u"};

Scanner sc= new Scanner(System.in);

System.out.println("Ingrese una frase");

texto= sc.nextLine();

nf=texto.split(" ");

nv= texto.split("");

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

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

if(nv[i].equalsIgnoreCase(v[j])){

cont++;

// nv[i]=String.valueOf(j+1);

nv[i]=(j+1)+"";

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

resp=resp+nv[i];

System.out.println("Palabras: "+nf.length);

System.out.println("Vocales: "+cont);

System.out.println("Nueva frase: "+resp);

You might also like