Error:
java.util.NoSuchElementException: No line found
at java.util.Scanner.nextLine(Unknown Source)
at PaqueteFacturaciones.Principal.main(Principal.java:76)
Code:
public class Principal {
public static void main(String[] args) {
int opcion;
String apeyNom;
String cuilCuit;
Scanner input = new Scanner(System.in);
System.out
.println("Que operacion desea realizar...?\n1-Factura\n2-Orden de compra\n0-Salir");
opcion = Integer.parseInt(input.nextLine());
try {
while (opcion != 0) {
if (opcion != 0) {
System.out.println("Ingrese Apellido y Nombre");
apeyNom = input.nextLine();
System.out.println("Ingrese CUIL/CUIT");
cuilCuit = input.nextLine();
Persona p = new Persona(apeyNom, cuilCuit);
switch (opcion) {
case 1: {
System.out.println("Ingrese numero de cliente");
long nroCliente = Long.parseLong(input.nextLine());
// long nroCliente=input.nextLong();
long nroFactura = 1;
Cliente clien = new Cliente(p.getApeyNom(),
p.getCuilCuit(), nroCliente);
System.out.println("Ingrese Cantidad de articulos");
int cantDeItems = Integer.parseInt(input.nextLine());
// int cantDeItems=input.nextInt();
Factura fact = new Factura(clien, nroFactura,
cantDeItems);
fact.ingresaItems();
System.out.println(fact);
fact.imprimeItems();
}
case 2: {
/*
* System.out.println("Ingrese numero de proveedor");
* long nroProvee=Long.parseLong(input.nextLine()); long
* nroOrden=1; Proveedor pr=new
* Proveedor(p.getApeyNom(),p.getCuilCuit(),nroProvee);
* System.out.println("Ingrese Cantidad de articulos");
* int cantDeItems=Integer.parseInt(input.nextLine());
* OrdenDeCompra orden=new
* OrdenDeCompra(pr,nroOrden,cantDeItems);
* orden.ingresaItems(); orden.imprimeItems();
*/
}
}
}
System.out
.println("Que operacion desea realizar...?\n1-Factura\n2-Orden de compra\n0-Salir");
opcion = Integer.parseInt(input.nextLine());
}
} catch (Exception e) {
e.printStackTrace();
}
}
}