Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.27 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package pruebaformaa1;
  7.  
  8. import java.io.BufferedReader;
  9. import java.io.IOException;
  10. import java.io.InputStreamReader;
  11. import java.util.ArrayList;
  12.  
  13. /**
  14.  *
  15.  * @author Noste Axl
  16.  */
  17. public class PruebaFormaA1 {
  18.  
  19.     /**
  20.      * @param args the command line arguments
  21.      */
  22.     public static void main(String[] args) throws IOException {
  23.         int num;
  24.         String op;
  25.         ArrayList lista1 = new ArrayList();
  26.         ArrayList lista2 = new ArrayList();
  27.         BufferedReader tec = new BufferedReader(new InputStreamReader(System.in));
  28.           while(0<10){
  29.         for (int i = 0; i < 3; i++) {
  30.             try{
  31.             System.out.println("Ingrese numero " + (i + 1) + ":");
  32.             num = Integer.parseInt(tec.readLine());
  33.               if (2 > num | num > 6) {
  34.                 System.out.println("Numero incorrecto");
  35.                 i--;
  36.             } else {
  37.                 lista1.add(num);
  38.             }    
  39.              
  40.             }catch (NumberFormatException ex){
  41.              System.out.println("Se pidio numero ...");
  42.              --i;
  43.             }
  44.             }
  45.          System.out.println(lista1);
  46.        
  47.         for (int i = 0; i < 3; i++) {
  48.        
  49.             System.out.println("Ingrese palabra "+(i+1)+":");
  50.             op = tec.readLine();
  51.             if ((int) op.length() != (int) lista1.get(i)) {
  52.                 System.out.println("Ingresa la plabra correcta");
  53.                 i--;
  54.             } else {
  55.                 lista2.add(op);
  56.    
  57.             }
  58.         }
  59.         ArrayList lista3 = new ArrayList();
  60.         for (int i = 0; i < 3; i++) {
  61.             String[] lista;
  62.             lista = new String[3];
  63.             lista[i] = new StringBuilder(lista2.get(i).toString()).reverse().toString();
  64.             lista3.add(lista[i]
  65.                     .replaceAll("a", "A")
  66.                     .replaceAll("e", "E")
  67.                     .replaceAll("i", "I")
  68.                     .replaceAll("o", "O")
  69.                     .replaceAll("e", "E"));
  70.         }
  71.         System.out.println(lista3);
  72.         break;
  73.     }
  74.      
  75. }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement