I'm working in activity for College, I'm trying to do a menu with options clearly, but when i put option "A" to introduce user and pass to verify the user and login in the system, the program doesnt move, doesnt ask the user. Just before system.out.blablaba option A or B.I just want to know if the keyboard input is correlativo to some element in the user and password arrays
package com.app;import java.io.File;import java.io.FileNotFoundException;import java.util.Scanner;public class Main {//cmd_instatic Scanner entradaConsola = new Scanner(System.in);public static void main(String[] args) throws FileNotFoundException { int cantMax = 10; String[] nombresVendedores = new String[cantMax]; String[] passVendedores = new String[cantMax]; String[] codPeliculas = new String[cantMax]; String[] nombrePeliculas = new String[cantMax]; String[] salaPeliculas = new String[cantMax]; int[] dispAsientos = new int[cantMax]; int[] precioEntrada = new int[cantMax]; String opcion = "1"; int cantVendedores = leerArchivos("vendedores.txt", opcion,nombresVendedores,passVendedores,codPeliculas,nombrePeliculas, salaPeliculas,dispAsientos,precioEntrada); opcion = "2"; int cantPeliculas = leerArchivos("peliculas.txt", opcion,nombresVendedores,passVendedores,codPeliculas,nombrePeliculas, salaPeliculas,dispAsientos,precioEntrada); while (true){ System.out.println("=== WELCOME TO CINE HOYTS ==="); System.out.println("Choose one option: "); System.out.println("A) Login"); System.out.println("B) Exit"); String eleccion = entradaConsola.nextLine(); if (eleccion.equalsIgnoreCase("a")){ String user = entradaConsola.nextLine(); String pass = entradaConsola.nextLine(); if (verificarUsuario(nombresVendedores,passVendedores,cantVendedores,user,pass)){ System.out.println("Sucesfull Login"); System.out.println(cantPeliculas); }else System.out.println("User/Password incorrect."); }else if (eleccion.equalsIgnoreCase("b")){ System.out.println("Good Bye. EXITING!"); break; }else System.out.println("Wrong options"); }}// read filepublic static int leerArchivos(String nombreArchivo, String opcion, String[] nombresVendedores, String[] passVendedores, String[] codPeliculas, String[] nombrePeliculas, String[] salaPeliculas, int[] dispAsientos, int[] precioEntradas) throws FileNotFoundException { File archivo = new File(nombreArchivo); Scanner lector = new Scanner(archivo); int cant = 0; switch (opcion){ case "1" -> { while (lector.hasNextLine()){ String linea = lector.nextLine(); String[] partes = linea.split(","); nombresVendedores[cant] = partes[0]; passVendedores[cant] = partes[1]; cant++; } } case "2" -> { while (lector.hasNextLine()){ String linea = lector.nextLine(); String[] partes = linea.split(","); codPeliculas[cant] = partes[0]; nombrePeliculas[cant] = partes[1]; salaPeliculas[cant] = partes[2]; dispAsientos[cant] = Integer.parseInt(partes[3]); precioEntradas[cant] = Integer.parseInt(partes[4]); cant++; } } }return cant;}// Verify if user existspublic static boolean verificarUsuario(String[] nombresVendedores, String[] passVendedores, int cantVendedores,String user,String pass){ for (int i = 0; i < cantVendedores; i++){ if (nombresVendedores[i].equalsIgnoreCase(user)){ if (passVendedores[i].equalsIgnoreCase(pass)){ return true; } } } return false;}
}