Salve a tutti,
sono qui oggi perche ho un problema con il mio programma che con
-nome
-cognome
-luogo di nascita
-giorno
-mese
-anno
-sesso(JRadioButton)
Mi calcoli il codice fiscale
Il programma calcola correttamente tutto fino al giorno(ad es. XXXXXX09B56) ma quando cerco di mettere anche il codice per il comune di nascita va in errore il tutto...
Contando che il file è strutturato in questo modo(txt):codice:try { FileReader filein = new FileReader("elenco-comuni-italiani.txt"); int next; do { next = filein.read(); // legge il prossimo carattere if (next != -1) { // se non e' finito il file char nextc = (char) next; for(int i=0;t=true;i++){ if(nextc==' '){ next = filein.read(); char nexta = (char) next; if(nexta==' '){ t=false; } } if(t=true) comune[i]=nextc; } String Comune=new String(comune); if(luogo.equals(Comune)){ for(;nexts==' ';){ next = filein.read(); nexts = (char) next; } Codice[x]=nexts; for(;x<14;x++){ next = filein.read(); nexts = (char) next; Codice[x]=nexts; } }else{ for(;nexts==' ';){ next = filein.read(); nexts = (char) next; } } } } while (next != -1); filein.close(); // chiude il file } catch (IOException E) { System.out.println(E); }
COMUNE CODICECORRISPONDENTE
Ad es.
Abano Terme A001