Hey,
kurze Frage zu einer Problematik.
Ich habe ein kleines Programm geschrieben was über mehrere Fragen und deren Antworten
dazu agiert. Da einer der Fragen wiederum Fragen zur Auswahl stellt, habe ich in der ersten While True Schleife eine zweite platziert.
Gibt man nun Close ein soll die innere While geschlossen werden und in der zweiten bei der Sprungmarke wieder anfangen.
Problem ist das dies nicht funktioniert und ich auch gerade nicht ganz verstehe, weshalb =)
Bin auch nicht besonders tief in der Materie.
Vllt hat jemand ja eine Idee weshalb.
Vielen Dank
Mit freundlichen Grüßen
DanyC
kurze Frage zu einer Problematik.
Ich habe ein kleines Programm geschrieben was über mehrere Fragen und deren Antworten
dazu agiert. Da einer der Fragen wiederum Fragen zur Auswahl stellt, habe ich in der ersten While True Schleife eine zweite platziert.
Gibt man nun Close ein soll die innere While geschlossen werden und in der zweiten bei der Sprungmarke wieder anfangen.
Problem ist das dies nicht funktioniert und ich auch gerade nicht ganz verstehe, weshalb =)
Bin auch nicht besonders tief in der Materie.
Vllt hat jemand ja eine Idee weshalb.
Vielen Dank
Mit freundlichen Grüßen
DanyC
Code:
package Info2;
import javax.swing.JOptionPane;
public class Info3 {
public static void main (String[] args) {
//Implimentier X,Y,Z
JOptionPane.showMessageDialog(null,"Implimentiert aktuell: \nX,Y,Z","Infotext",JOptionPane.WARNING_MESSAGE);
//Closer
String c1 = "close",
c2 = "Close";
LoopOne:
while (true) {
String e1 = JOptionPane.showInputDialog("Hey,\nwähle aus?");
//Zusatz Info
String v11 = "F1",
v111= "f1",
v12 = "Fr1",
v121= "fr1",
v13 = "Fr2",
//Johanna
v21 = "J1",
v211= "j1",
v22 = "J2",
v221= "j2",
v23 = "J3",
v24 = "j3",
v31 = "M1",
v311= "m2",
v32 = "L12",
v41 = "F1",
v411= "f1",
v51 = "L1",
v511= "l2",
v52 = "HL1",
v521= "hL1",
v522= "hl1",
v523= "HL1",
j1 = "Ja",
j2 = "ja",
n1 = "Nein",
n2 = "nein";
String am5 = "X",
am6 = "X",
am7 = "X",
am8 = "X";
String v53 = "X";
String s1 = "X";
String af1 = "X",
af2 = "X",
af3 = "X";
String aj1 = "X",
aj2 = "X",
aj3 = "X",
aj4 = "X",
aj5 = "X",
aj6 = "X";
String am1 = "X",
am2 = "X",
am3 = "X",
am4 = "X",
am9 = "X";
String afr1 = "X";
String alf1 = "X",
alf2 = "X",
alf3 = "X",
alf31= "X",
alf4 = "X",
alf5 = "X",
alf6 = "X",
alf7 = "X",
alf71= "X",
alf8 = "X",
ali1 = "X",
ali2 = "X",
//Frage 1
ala1 = "X",
//Frage 2
ala2 = "X",
//Frage 3
ala3 = "X",
ala31= "X",
ala32= "X",
//Frage 4
ala4 = "X",
//Frage 5
ala5 = "X",
//Frage 6
ala6 = "X",
//Frage 7
ala7 = "X",
ala71= "X",
//Frage 8
ala8 = "X";
double e32 = 1.0;
//Input 2
if (e1.equals(c1)||e1.equals(c2)) {
break;
}
else {
if (e1.equals(v11) || e1.equals(v12)|| e1.equals(v111)|| e1.equals(v121)) {
String e2 = JOptionPane.showInputDialog(af1+v13+s1);
if (e2.equals(j1)|| e2.equals(j2)) {
JOptionPane.showMessageDialog(null, af2);
continue;
}
else {
JOptionPane.showMessageDialog(null, af3);
continue;
}
}
else {
if (e1.equals(v21) || e1.equals(v22)|| e1.equals(v211)|| e1.equals(v221)) {
String e3 = JOptionPane.showInputDialog(aj1+v23+s1+aj2);
double e31 = Double.parseDouble(e3);
if (e31 >= e32) {
if(e31> 5) {
JOptionPane.showMessageDialog(null, aj6);
continue;
}
else {
JOptionPane.showMessageDialog(null, aj3+v23+aj4);
continue;
}
}
else {
if (e31< e32) {
if (e31< 0) {
JOptionPane.showMessageDialog(null, aj5);
}
JOptionPane.showMessageDialog(null, aj6+v24);
continue;
}
else {
continue;
}
}
}
else {
if (e1.equals(v31)|| e1.equals(v311)) {
String e4 = JOptionPane.showInputDialog(am1 +v32+s1);
if (e4.equals(j1)|| e4.equals(j2)) {
String e41 = JOptionPane.showInputDialog(am2);
if (e41.equals(j1)|| e41.equals(j2)) {
JOptionPane.showMessageDialog(null, am3);
}
else {
if (e41.equals(n1)|| e41.equals(n2)){
JOptionPane.showMessageDialog(null, am4);
continue;
}
else {
JOptionPane.showMessageDialog(null, am5+v32+am6+j1+am7+n1+am8);
continue;
}
}
}
else {
if (e4.equals(n1)||e4.equals(n2)){
JOptionPane.showMessageDialog(null, am9);
continue;
}
else {
JOptionPane.showMessageDialog(null, am5+v32+am6+j1+am7+n1+am8);
continue;
}
}
}
else {
if (e1.equals(v41)|| e1.equals(v411)) {
JOptionPane.showMessageDialog(null, afr1);
}
else {
if (e1.equals(v53)||e1.equals(v51)|| e1.equals(v511)|| e1.equals(v52)|| e1.equals(v521)|| e1.equals(v522)|| e1.equals(v523)) {
while (true) {
String e5 = JOptionPane.showInputDialog(alf1+alf2+alf3+alf4+alf5+alf6+alf7+alf8+ali1+ali2);
int e51 = Integer.parseInt(e5);
//close while 2
if(e5.equals(c1)||e5.equals(c2)) {
break LoopOne;
}
else {
if (e51==1) {
JOptionPane.showMessageDialog(null,alf1+ala1);
continue;
}
else {
if (e51==2) {
JOptionPane.showMessageDialog(null, alf2+ala2);
continue;
}
else {
if (e51==3) {
String e6 = JOptionPane.showInputDialog(alf3+ala3);
if (e6.equals(j1)||e6.equals(j2)) {
JOptionPane.showMessageDialog(null, alf31+ala31);
continue;
}
else {
if (e6.equals(n1)||e6.equals(n2)){
JOptionPane.showMessageDialog(null, alf3+ ala32);
continue;
}
}
}
else {
if (e51==4) {
JOptionPane.showMessageDialog(null, alf4+ala4);
continue;
}
else {
if (e51==5) {
JOptionPane.showMessageDialog(null, alf5+ala5);
continue;
}
else {
if (e51==6) {
JOptionPane.showMessageDialog(null, alf6+ala6);
continue;
}
else {
if (e51==7) {
String e7 = JOptionPane.showInputDialog(alf71);
if (e7.equals(j1)||e7.equals(j2)) {
JOptionPane.showMessageDialog(null, alf7+ala7);
continue;
}
else {
if (e7.equals(n1)||e7.equals(n2)) {
JOptionPane.showMessageDialog(null,alf7+ala71);
continue;
}
}
}
else {
if (e51==8) {
JOptionPane.showMessageDialog(null, alf8+ala8);
continue;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}