mardi 2 juin 2015
Java Programm für Prüfzahl Berechnung eines Persnalausweises bzw. Prüfung auf Richtigkeit
Posted on 23:26 by verona
Hallo,
Ich muss aktuell ein Java-Projekt für die schule realisieren und habe nun auch schon den Großteil gemacht leider wirft Java bei meinem Projekt immer einen Fehler aus. Der da wäre :
Ich habe keine Ahnung woran dies liegen könnte bitte um Hilfe
hier der Quelltext:
Vielen Dank schon einmal ;)
Ich muss aktuell ein Java-Projekt für die schule realisieren und habe nun auch schon den Großteil gemacht leider wirft Java bei meinem Projekt immer einen Fehler aus. Der da wäre :
Code:
Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: "" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:592)
at java.lang.Integer.parseInt(Integer.java:615)
at personalausweis.jButton1_ActionPerformed(personalausweis.java:324)
at personalausweis$1.actionPerformed(personalausweis.java:222)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2346)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.Component.processMouseEvent(Component.java:6525)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6290)
at java.awt.Container.processEvent(Container.java:2234)
at java.awt.Component.dispatchEventImpl(Component.java:4881)
at java.awt.Container.dispatchEventImpl(Container.java:2292)
at java.awt.Component.dispatchEvent(Component.java:4703)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4533)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462)
at java.awt.Container.dispatchEventImpl(Container.java:2278)
at java.awt.Window.dispatchEventImpl(Window.java:2750)
at java.awt.Component.dispatchEvent(Component.java:4703)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.awt.EventQueue$4.run(EventQueue.java:729)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
hier der Quelltext:
Java Code:
-
-
-
import java.awt.*;
-
import java.awt.event.*;
-
import javax.swing.*;
-
import javax.swing.event.*;
-
-
-
-
-
-
-
-
-
// Anfang Attribute
-
private JNumberField jNumberField1 = new JNumberField();
-
private JNumberField jNumberField2 = new JNumberField();
-
private JNumberField jNumberField3 = new JNumberField();
-
private JNumberField jNumberField4 = new JNumberField();
-
private JNumberField jNumberField5 = new JNumberField();
-
private JNumberField jNumberField6 = new JNumberField();
-
private JNumberField jNumberField7 = new JNumberField();
-
private JNumberField jNumberField8 = new JNumberField();
-
private JNumberField jNumberField9 = new JNumberField();
-
private JNumberField jNumberField10 = new JNumberField();
-
private JNumberField jNumberField11 = new JNumberField();
-
private JNumberField jNumberField12 = new JNumberField();
-
private JNumberField jNumberField13 = new JNumberField();
-
private JNumberField jNumberField14 = new JNumberField();
-
private JNumberField jNumberField15 = new JNumberField();
-
private JNumberField jNumberField16 = new JNumberField();
-
private JNumberField jNumberField17 = new JNumberField();
-
private JNumberField jNumberField18 = new JNumberField();
-
private JNumberField jNumberField19 = new JNumberField();
-
private JNumberField jNumberField20 = new JNumberField();
-
private JNumberField jNumberField21 = new JNumberField();
-
private JNumberField jNumberField22 = new JNumberField();
-
private JNumberField jNumberField23 = new JNumberField();
-
private JNumberField jNumberField24 = new JNumberField();
-
private JNumberField jNumberField25 = new JNumberField();
-
-
-
-
String nachname;
-
String vorname;
-
int zahl1;
-
int zahl2;
-
int zahl3;
-
int zahl4;
-
int zahl5;
-
int zahl6;
-
int zahl7;
-
int zahl8;
-
int zahl9;
-
int zahl10;
-
int zahl11;
-
int zahl12;
-
int zahl13;
-
int zahl14;
-
int zahl15;
-
int zahl16;
-
int zahl17;
-
int zahl18;
-
int zahl19;
-
int zahl20;
-
int zahl21;
-
int zahl22;
-
int zahl23;
-
int zahl24;
-
int zahl25;
-
-
-
-
-
-
// Ende Attribute
-
-
// Frame-Initialisierung
-
super(title);
-
int frameWidth = 800;
-
int frameHeight = 784;
-
setSize(frameWidth, frameHeight);
-
int x = (d.width - getSize().width) / 2;
-
int y = (d.height - getSize().height) / 2;
-
setLocation(x, y);
-
setResizable(false);
-
cp.setLayout(null);
-
// Anfang Komponenten
-
-
jLabel1.setBounds(74, 88, 30, 25);
-
jLabel1.setText("<<");
-
cp.add(jLabel1);
-
jTextField1.setBounds(96, 88, 94, 25);
-
-
cp.add(jTextField1);
-
jLabel2.setBounds(192, 88, 30, 25);
-
jLabel2.setText("<<");
-
cp.add(jLabel2);
-
jTextField2.setBounds(216, 88, 94, 25);
-
cp.add(jTextField2);
-
jLabel3.setBounds(312, 88, 94, 25);
-
jLabel3.setText("<<<<<<<<<<<<<");
-
cp.add(jLabel3);
-
jNumberField1.setBounds(48, 120, 19, 25);
-
jNumberField1.setText("");
-
cp.add(jNumberField1);
-
jNumberField2.setBounds(72, 120, 19, 25);
-
jNumberField2.setText("");
-
cp.add(jNumberField2);
-
jNumberField3.setBounds(96, 120, 19, 25);
-
jNumberField3.setText("");
-
cp.add(jNumberField3);
-
jNumberField4.setBounds(120, 120, 19, 25);
-
jNumberField4.setText("");
-
cp.add(jNumberField4);
-
jNumberField5.setBounds(144, 120, 19, 25);
-
jNumberField5.setText("");
-
cp.add(jNumberField5);
-
jNumberField6.setBounds(168, 120, 19, 25);
-
jNumberField6.setText("");
-
cp.add(jNumberField6);
-
jNumberField7.setBounds(192, 120, 19, 25);
-
jNumberField7.setText("");
-
cp.add(jNumberField7);
-
jNumberField8.setBounds(216, 120, 19, 25);
-
jNumberField8.setText("");
-
cp.add(jNumberField8);
-
jNumberField9.setBounds(240, 120, 19, 25);
-
jNumberField9.setText("");
-
cp.add(jNumberField9);
-
jNumberField10.setBounds(264, 120, 19, 25);
-
jNumberField10.setText("");
-
cp.add(jNumberField10);
-
jTextField4.setBounds(288, 120, 30, 25);
-
cp.add(jTextField4);
-
jLabel4.setBounds(48, 88, 30, 25);
-
jLabel4.setText("IDD");
-
cp.add(jLabel4);
-
jLabel5.setBounds(320, 120, 14, 25);
-
jLabel5.setText("<<");
-
cp.add(jLabel5);
-
jNumberField11.setBounds(336, 120, 19, 25);
-
jNumberField11.setText("");
-
cp.add(jNumberField11);
-
jNumberField12.setBounds(360, 120, 19, 25);
-
jNumberField12.setText("");
-
cp.add(jNumberField12);
-
jNumberField13.setBounds(384, 120, 19, 25);
-
jNumberField13.setText("");
-
cp.add(jNumberField13);
-
jNumberField14.setBounds(408, 120, 19, 25);
-
jNumberField14.setText("");
-
cp.add(jNumberField14);
-
jNumberField15.setBounds(432, 120, 19, 25);
-
jNumberField15.setText("");
-
cp.add(jNumberField15);
-
jNumberField16.setBounds(456, 120, 19, 25);
-
jNumberField16.setText("");
-
cp.add(jNumberField16);
-
jNumberField17.setBounds(480, 120, 19, 25);
-
jNumberField17.setText("");
-
cp.add(jNumberField17);
-
jLabel6.setBounds(504, 120, 14, 25);
-
jLabel6.setText("<");
-
cp.add(jLabel6);
-
jNumberField18.setBounds(520, 120, 19, 25);
-
jNumberField18.setText("");
-
cp.add(jNumberField18);
-
jNumberField19.setBounds(544, 120, 19, 25);
-
jNumberField19.setText("");
-
cp.add(jNumberField19);
-
jNumberField20.setBounds(568, 120, 19, 25);
-
jNumberField20.setText("");
-
cp.add(jNumberField20);
-
jNumberField21.setBounds(592, 120, 19, 25);
-
jNumberField21.setText("");
-
cp.add(jNumberField21);
-
jNumberField22.setBounds(616, 120, 19, 25);
-
jNumberField22.setText("");
-
cp.add(jNumberField22);
-
jNumberField23.setBounds(640, 120, 19, 25);
-
jNumberField23.setText("");
-
cp.add(jNumberField23);
-
jNumberField24.setBounds(664, 120, 19, 25);
-
jNumberField24.setText("");
-
cp.add(jNumberField24);
-
jLabel7.setBounds(688, 120, 54, 25);
-
jLabel7.setText("<<<<<<<");
-
cp.add(jLabel7);
-
jNumberField25.setBounds(738, 120, 19, 25);
-
jNumberField25.setText("");
-
cp.add(jNumberField25);
-
jLabel8.setBounds(88, 336, 627, 425);
-
jLabel8.setText("Perso.png");
-
cp.add(jLabel8);
-
-
-
jButton1.setBounds(328, 200, 171, 65);
-
jButton1.setText("Personalausweis Prüfen");
-
jButton1_ActionPerformed(evt);
-
}
-
});
-
cp.add(jButton1);
-
jLabel9.setBounds(216, 16, 403, 41);
-
jLabel9.setText("Geben sie die Prüfziffern ihres Personalasweises ein. (Siehe unten)");
-
cp.add(jLabel9);
-
setTitle("IDC - Identification Check");
-
-
-
-
-
-
-
// Ende Komponenten
-
-
setVisible(true);
-
}
-
-
// Anfang Methoden
-
-
-
nachname = jTextField1.getSelectedText();
-
vorname = jTextField2.getSelectedText();
-
-
zahl1 = jNumberField1.getInt();
-
zahl2 = jNumberField2.getInt();
-
zahl3 = jNumberField3.getInt();
-
zahl4 = jNumberField4.getInt();
-
zahl5 = jNumberField5.getInt();
-
zahl6 = jNumberField6.getInt();
-
zahl7 = jNumberField7.getInt();
-
zahl8 = jNumberField8.getInt();
-
zahl9 = jNumberField9.getInt();
-
zahl10 = jNumberField10.getInt();
-
zahl11 = jNumberField11.getInt();
-
zahl12 = jNumberField12.getInt();
-
zahl13 = jNumberField13.getInt();
-
zahl14 = jNumberField14.getInt();
-
zahl15 = jNumberField15.getInt();
-
zahl16 = jNumberField16.getInt();
-
zahl17 = jNumberField17.getInt();
-
zahl18 = jNumberField18.getInt();
-
zahl19 = jNumberField19.getInt();
-
zahl20 = jNumberField20.getInt();
-
zahl21 = jNumberField21.getInt();
-
zahl22 = jNumberField22.getInt();
-
zahl23 = jNumberField23.getInt();
-
zahl24 = jNumberField24.getInt();
-
zahl25 = jNumberField25.getInt();
-
-
-
zahl1 = zahl1 * 7;
-
zahl2 = zahl2 * 3;
-
zahl3 = zahl3 * 1;
-
zahl4 = zahl4 * 7;
-
zahl5 = zahl5 * 3;
-
zahl6 = zahl6 * 1;
-
zahl7 = zahl7 * 7;
-
zahl8 = zahl8 * 3;
-
zahl9 = zahl9 * 1;
-
zahl11 = zahl11 * 3;
-
zahl12 = zahl12 * 1;
-
zahl13 = zahl13 * 7;
-
zahl14 = zahl14 * 3;
-
zahl15 = zahl15 * 1;
-
zahl16 = zahl16 * 7;
-
zahl18 = zahl18 * 1;
-
zahl19 = zahl19 * 7;
-
zahl20 = zahl20 * 3;
-
zahl21 = zahl21 * 1;
-
zahl22 = zahl22 * 7;
-
zahl23 = zahl23 * 3;
-
-
-
//zahl1
-
int index1 = s1.length();
-
int länge1 = index1-1;
-
s1 = s1.substring(länge1, index1);
-
-
-
-
//zahl2
-
int index2 = s2.length();
-
int länge2 = index1-1;
-
s2 = s2.substring(länge2, index2);
-
-
-
//zahl3
-
int index3 = s3.length();
-
int länge3 = index1-1;
-
s3 = s3.substring(länge3, index3);
-
-
-
-
//zahl4
-
int index4 = s4.length();
-
int länge4 = index1-1;
-
s4 = s4.substring(länge4, index4);
-
-
//zahl5
-
int index5 = s5.length();
-
int länge5 = index1-1;
-
s5 = s5.substring(länge5, index5);
-
-
//zahl6
-
int index6 = s6.length();
-
int länge6 = index1-1;
-
s6 = s6.substring(länge6, index6);
-
-
//zahl7
-
int index7 = s7.length();
-
int länge7 = index1-1;
-
s7 = s7.substring(länge7, index7);
-
-
//zahl8
-
int index8 = s8.length();
-
int länge8 = index1-1;
-
s8 = s8.substring(länge8, index8);
-
-
//zahl9
-
int index9 = s9.length();
-
int länge9 = index1-1;
-
s9 = s9.substring(länge9, index9);
-
-
//zahl11
-
int index11 = s11.length();
-
int länge11 = index1-1;
-
s11 = s11.substring(länge11, index11);
-
-
//zahl12
-
int index12 = s12.length();
-
int länge12 = index1-1;
-
s12 = s12.substring(länge12, index12);
-
-
//zahl13
-
int index13 = s13.length();
-
int länge13 = index1-1;
-
s13 = s13.substring(länge13, index13);
-
-
//zahl14
-
int index14 = s14.length();
-
int länge14 = index1-1;
-
s14 = s14.substring(länge14, index14);
-
-
//zahl15
-
int index15 = s15.length();
-
int länge15 = index1-1;
-
s15 = s15.substring(länge15, index15);
-
-
//zahl16
-
int index16 = s16.length();
-
int länge16 = index1-1;
-
s16 = s16.substring(länge16, index16);
-
-
//zahl18
-
int index18 = s18.length();
-
int länge18 = index1-1;
-
s18 = s18.substring(länge18, index18);
-
-
//zahl19
-
int index19 = s19.length();
-
int länge19 = index1-1;
-
s19 = s19.substring(länge19, index19);
-
-
//zahl20
-
int index20 = s20.length();
-
int länge20 = index1-1;
-
s20 = s20.substring(länge20, index20);
-
-
//zahl21
-
int index21 = s21.length();
-
int länge21 = index1-1;
-
s21 = s21.substring(länge21, index21);
-
-
//zahl22
-
int index22 = s22.length();
-
int länge22 = index1-1;
-
s22 = s22.substring(länge22, index22);
-
-
//zahl23
-
int index23 = s23.length();
-
int länge23 = index1-1;
-
s23 = s23.substring(länge23, index23);
-
-
-
-
//Prüfziffer1(zahl10)
-
int pruef1;
-
pruef1 = z1 + z2 + z3 + z4 + z5 + z6 + z7 + z8 + z9;
-
int indexp1 = p1.length();
-
int längep1 = index1-1;
-
p1 = p1.substring(längep1, indexp1);
-
-
//Prüfziffer2 (zahl17)
-
int pruef2;
-
pruef2 = z11 + z12 + z13 + z14 + z15 + z16;
-
int indexp2 = p2.length();
-
int längep2 = index1-1;
-
p2 = p2.substring(längep2, indexp2);
-
-
//Prüfziffer3 (zahl124)
-
int pruef3;
-
pruef3 = z18 + z19 + z20 + z21 + z22 + z23;
-
int indexp3 = p3.length();
-
int längep3 = index1-1;
-
p3 = p3.substring(längep3, indexp3);
-
-
//Prüfziffer4 (zahl25)
-
int pruef4;
-
pruef4 = pruef1 + pruef2 + pruef3 + pu1 * 7 + pu2 * 3 + pu3 * 1;
-
int indexp4 = p4.length();
-
int längep4 = index1-1;
-
p4 = p4.substring(längep4, indexp4);
-
-
-
if(zahl10 == pu1 && zahl17 == pu2 && zahl24 == pu3 && zahl25 == pu4){
-
-
-
}
-
else{
-
-
}
-
-
}
-
-
-
// Ende Methoden
-
-
new personalausweis("IDC - Identification Check");
-
-
-
-
}
-
}
Vielen Dank schon einmal ;)
Java Programm für Prüfzahl Berechnung eines Persnalausweises bzw. Prüfung auf Richtigkeit
Inscription à :
Publier les commentaires (Atom)
0 commentaires:
Enregistrer un commentaire