Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package pruebaformaa1;
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.util.ArrayList;
- /**
- *
- * @author Noste Axl
- */
- public class PruebaFormaA1 {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) throws IOException {
- int num;
- String op;
- ArrayList lista1 = new ArrayList();
- ArrayList lista2 = new ArrayList();
- BufferedReader tec = new BufferedReader(new InputStreamReader(System.in));
- while(0<10){
- for (int i = 0; i < 3; i++) {
- try{
- System.out.println("Ingrese numero " + (i + 1) + ":");
- num = Integer.parseInt(tec.readLine());
- if (2 > num | num > 6) {
- System.out.println("Numero incorrecto");
- i--;
- } else {
- lista1.add(num);
- }
- }catch (NumberFormatException ex){
- System.out.println("Se pidio numero ...");
- --i;
- }
- }
- System.out.println(lista1);
- for (int i = 0; i < 3; i++) {
- System.out.println("Ingrese palabra "+(i+1)+":");
- op = tec.readLine();
- if ((int) op.length() != (int) lista1.get(i)) {
- System.out.println("Ingresa la plabra correcta");
- i--;
- } else {
- lista2.add(op);
- }
- }
- ArrayList lista3 = new ArrayList();
- for (int i = 0; i < 3; i++) {
- String[] lista;
- lista = new String[3];
- lista[i] = new StringBuilder(lista2.get(i).toString()).reverse().toString();
- lista3.add(lista[i]
- .replaceAll("a", "A")
- .replaceAll("e", "E")
- .replaceAll("i", "I")
- .replaceAll("o", "O")
- .replaceAll("e", "E"));
- }
- System.out.println(lista3);
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement