I am trying to create a program that stores license plates and names to create a database, however, when I run it, I get this error:
apturas.java:71: error: no suitable method found for showInputDialog(<null>,String,String,String,String)
opcion_consultas=(JOptionPane.showInputDialog(null,"Consultas","1.Generales","2.Registro","3.Regresar"));
^
method JOptionPane.showInputDialog(Object) is not applicable
(actual and formal argument lists differ in length)
method JOptionPane.showInputDialog(Object,Object) is not applicable
(actual and formal argument lists differ in length)
method JOptionPane.showInputDialog(Component,Object) is not applicable
(actual and formal argument lists differ in length)
method JOptionPane.showInputDialog(Component,Object,Object) is not applicable
(actual and formal argument lists differ in length)
method JOptionPane.showInputDialog(Component,Object,String,int) is not applicable
(actual and formal argument lists differ in length)
method JOptionPane.showInputDialog(Component,Object,String,int,Icon,Object[],Object) is not applicable
(actual and formal argument lists differ in length)
Capturas.java:136: error: variable cancel is already defined in method main(String[])
int cancel=JOptionPane.showInputDialog(null,"1. Fisica","2. Logica","3. Regresar");
^
Capturas.java:136: error: incompatible types: String cannot be converted to int
int cancel=JOptionPane.showInputDialog(null,"1. Fisica","2. Logica","3. Regresar");
^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
3 errors
What am I doing wrong in my code?
import java.io.*;
import javax.swing.*;
public class Capturas{
public static void main(String[]args){
String[]nombre=new String[5];
String auxnombre;
int[]num=new int[5]; int opcion_consultas=0;
int opcion_menu=0; int encontrar=0;
int capture1; int cancel=0;
int auxnum=0; int back=0;
int casillas=0; int go=0;
int x=0; int opcion_cambios=0;
int y=0;
int error;
int otro=0;
int yaesta=0;
int renglon=0;
int min;
do
{
opcion_menu=Integer.parseInt(JOptionPane.showInputDialog("Ingresa la opcion deseada: \n 1.Captura \n 2.Consulta \n 3.Cambios \n 4.Cancelaciones \n 5.Reinstalacion \n 6.Salida") );
if(opcion_menu==1)
{
if(casillas<4)
{
yaesta=0;
auxnum=Integer.parseInt(JOptionPane.showInputDialog(null,"Ingresa el numero contable"));
for(x=1; x<=4; x++)
{
if(auxnum==num[x])
{
yaesta=1;
}
}
if(yaesta==1)
{
JOptionPane.showMessageDialog(null, "El numero ya esta registrado");
}
if(yaesta==0)
renglon=0;
{
for(x=1; x<=4; x++)
{
if(nombre[x]!=null)
{
renglon=renglon+1;
}
}
renglon=renglon+1;
num[renglon]=auxnum;
nombre[renglon]=JOptionPane.showInputDialog("Ingresa el Nombre");
casillas=casillas+1;
}
}
}
if(opcion_menu==2)
{
do{
opcion_consultas=(JOptionPane.showInputDialog(null,"Consultas","1.Generales","2.Registro","3.Regresar"));
if(opcion_consultas==2)
{
encontrar=0;
auxnum=Integer.parseInt(JOptionPane.showInputDialog(null,"\n Ingrese la matricula"));
for(x=1; x<=5; x++)
{
if(auxnum==num[x])
{
encontrar=1;
JOptionPane.showMessageDialog(null,"Registro No." +x+"\n Nombre: " +nombre[x]+"Numero de matricula"+num[x]);
}
}
if(encontrar==0)
{
JOptionPane.showMessageDialog(null,"El numero de matricula no existe");
}
}
if(opcion_consultas==1)
{
for(x=1; x<5; x++)
{
min=x;
for(y=x+1; y<5; y++)
{
if(num[y]>=num[min])
{
min=y;
}
}
if(x!=min)
{
auxnum=num[x];
auxnombre=nombre[x];
num[x]=num[min];
nombre[x]=nombre[min];
num[min]=auxnum;
nombre[min]=auxnombre;
}
}
for(x=5; x>=1; x--)
{
if(nombre[x]!=null)
{
JOptionPane.showMessageDialog(null,"Registro"+x+"\n Nombre: "+nombre[x]+"Numero de matricula: "+num[x]);
}
}
}
if(opcion_consultas==3)
{
otro=1;
}
}while(otro!=1);
}
if(opcion_menu==3)
{}
if(opcion_menu==4)
{
do
{
int cancel=JOptionPane.showInputDialog(null,"1. Fisica","2. Logica","3. Regresar");
if(cancel==1){}
if(cancel==2){}
if(cancel==3)
{
back=1;
}
}while(back!=1);
}
if(opcion_menu==5)
{
}
if(opcion_menu==6)
{
JOptionPane.showMessageDialog(null,"Opcion de Salida");
do{
go=Integer.parseInt(JOptionPane.showInputDialog("¿Desea salir del programa? 1. Si 2. No"));
if(go==0 || go>2)
{
JOptionPane.showInputDialog(null,"ERROR");
}
} while(go==0 || go>2);
if(go==1)
{
System.exit(0);
JOptionPane.showMessageDialog(null,"Gracias por usar el programa");
}
}}while(opcion_menu!=6);
}
}