AplicacionesString

AplicacionesString - case 'U': case 'u': nu++; break;}}

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.io.*; i public class AplicacionesString{ p public static BufferedReader entrada = new BufferedReader(new InputStreamReader(System.in)); public static PrintWriter salida = new PrintWriter(System.out, true); p public static int cuentaVocales(String p){ int cont = 0; for(int i=0; i<p.length(); i++){ if(p.charAt(i)=='a' || p.charAt(i)=='e' || p.charAt(i)=='i' || p.charAt(i)=='o' || p.charAt(i)=='u') cont++;} return cont;} r public static void cuentaAEIOU(String p){ int na, ne, ni, no, nu; na = ne = ni = no = nu = 0; for(int i=0; i<p.length(); i++){ switch(p.charAt(i)){ case 'A': case 'a': na++; break; case 'E': case 'e': ne++; break; case 'I': case 'i': ni++; break; case 'O': case 'o': no++; break;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: case 'U': case 'u': nu++; break;}} salida.println(&quot;A/a = &quot;+na+&quot; | E/e = &quot;+ne+&quot; | I/i = &quot;+ni+&quot; | O/o = &quot;+no+&quot; | U/u = &quot;+nu); } public static void main(String args) throws IOException{ p System.out.println(&quot; inicio de la aplicacin \n&quot;); S String user = &quot;&quot;; String palabra = &quot;&quot;; S do{ salida.println(&quot;Dime una palabra: &quot;); palabra = entrada.readLine(); p salida.println(&quot;\n &amp; sta palabra tiene &quot;+cuentaVocales(palabra)+&quot; vocales.&quot;); cuentaAEIOU(palabra); salida.println(&quot;\n Deseas continuar? (s/no)&quot;); user = entrada.readLine(); }while(user.toLowerCase().equals(&quot;si&quot;)); } System.out.println(&quot;\n fin de la aplicacin &quot;); S } } }...
View Full Document

Page1 / 2

AplicacionesString - case 'U': case 'u': nu++; break;}}

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online