Este blog está dedicado a la recolección de información relacionada con las nuevas tecnologías ( tecnoloxía xa), especialmente, con las vinculadas a la informática.
La idea es centralizar y compartir la información y cada manual o tutorial que voy recolectando para las clases tanto de administración de sistemas como de explotación de sistemas informáticos de modo que estén disponibles para alumnos y resto de interesados. (IES A Carballeira, Ourense)
this.cadena = cadena;
vocales = new int[5];
contarVocales();
}
public int getA()
{
return vocales[0];
}
public int getE()
{ //si queremos actualizar podríamos hacer una llamada a: //contarVocales();
return vocales[1];
}
public int getI()
{
return vocales[2];
}
public int getO()
{
return vocales[3];
}
public int getU()
{
return vocales[4];
}
public int [] getVocales(){
contarVocales();
return vocales;
}
private void contarVocales(){
int cont=0,pos;
String vocal = "aeiou";
for (int i = 0; i < cadena.length(); i++) {
pos = vocal.indexOf(cadena.toLowerCase().charAt(i));
if ( pos != -1 ) ++vocales[pos];
}
}
}
// Ventana aplicación visual
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package unidad4u352;
/**
*
* @author Juan
*/
public class VentVocales extends javax.swing.JFrame {
/**
* Creates new form VentVocales
*/
public VentVocales() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
txtCadena = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
lblA = new javax.swing.JLabel();
lblE = new javax.swing.JLabel();
lblI = new javax.swing.JLabel();
lblO = new javax.swing.JLabel();
lblU = new javax.swing.JLabel();
btnCalcular = new javax.swing.JButton();
1 comentario:
excelente trabajo
Publicar un comentario