Name: lazy motherfucker 2008-10-20 12:40
why doesn't this shit read the second string i ask it to read when you hit no. 2?
also, messages in spanish as it is for a college project and i live in some crappy southamerican country and i'm too lazy to change it
import java.io.*;
public class principal {
public static void main (String args[]) {
boolean menu=true;
String textocodificar = null;
String clavecodificacion = null;
char opcion = '0';
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
while (menu == true) {
System.out.println ("menu:");
System.out.println (" blah blah");
System.out.print ("Enter a number (the only one that works is no. 2)");
try {
opcion = (char) System.in.read();
} catch (IOException e) {
e.printStackTrace();
}
if (opcion == '2') {
System.out.println ("Opción 2: Codificar mensaje");
System.out.println ("Por favor, introduzca el texto a codificar: ");
try {
textocodificar = bf.readLine();
} catch (IOException e) {
e.printStackTrace();
}
System.out.print ("Introduzca la clave: ");
try {
clavecodificacion = bf.readLine();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println ("La Codificación Vinegère del texto dado es: ");
System.out.println ("El texto 'mide' " + textocodificar.length());
System.out.println ("La clave 'mide' " + clavecodificacion.length());
try {
System.in.read();
} catch (IOException e) {
e.printStackTrace();
}
}
if (opcion == '4') {
menu=false;
}
}
}
}
also, messages in spanish as it is for a college project and i live in some crappy southamerican country and i'm too lazy to change it
import java.io.*;
public class principal {
public static void main (String args[]) {
boolean menu=true;
String textocodificar = null;
String clavecodificacion = null;
char opcion = '0';
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
while (menu == true) {
System.out.println ("menu:");
System.out.println (" blah blah");
System.out.print ("Enter a number (the only one that works is no. 2)");
try {
opcion = (char) System.in.read();
} catch (IOException e) {
e.printStackTrace();
}
if (opcion == '2') {
System.out.println ("Opción 2: Codificar mensaje");
System.out.println ("Por favor, introduzca el texto a codificar: ");
try {
textocodificar = bf.readLine();
} catch (IOException e) {
e.printStackTrace();
}
System.out.print ("Introduzca la clave: ");
try {
clavecodificacion = bf.readLine();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println ("La Codificación Vinegère del texto dado es: ");
System.out.println ("El texto 'mide' " + textocodificar.length());
System.out.println ("La clave 'mide' " + clavecodificacion.length());
try {
System.in.read();
} catch (IOException e) {
e.printStackTrace();
}
}
if (opcion == '4') {
menu=false;
}
}
}
}