У меня возникли проблемы с получением цикла for в моей программе для wrok. Я не уверен, что я делаю неправильно. Я работаю над ним около 3 часов и до сих пор не знаю, что делать.Для цикла: мой цикл цикла не выполняется должным образом
Я исправил заявление while. Это не проблема. Проблема заключается в том, что цикл for находится в нижней части кода.
Вот мой код:
while(!(strSelection=("5")))
{
strSelection=JOptionPane.showInputDialog(
null, "~~Please make a selection from the menu below~~"+
"\n\n1. Add a new advisee"+
"\n2. Update and advisee's information"+
"\n3. Display all advisees"+
"\n4. Display advisees who are cleared to graduate"+
"\n5. Exit"+
"\n\nWhat is your selection?", "Menu", 3);
switch(strSelection)
{
case "1":
String strString;
String strHours;
int iHours;
String strMajor;
boolean blnMajor;
String strIntent;
boolean blnIntent;
adv[iCount]=new Advisee();
adv[iCount].setName(JOptionPane.showInputDialog(null,"What is the advisee's name?","Name",3));
adv[iCount].setID(JOptionPane.showInputDialog(null,"What is the advisee's ID?","ID",3));
adv[iCount].setConcentration(JOptionPane.showInputDialog(null,"What is the advisee's concentration?","Concentration",3));
adv[iCount].setAdvisor(strAdvisor);
strHours=JOptionPane.showInputDialog(null,"What are the advisee's completed hours?","Completed Hours",3);
iHours=Integer.parseInt(strHours);
adv[iCount].setHoursCompleted(iHours);
strMajor=JOptionPane.showInputDialog(null,"Does the advisee have the major sheet?","Major Sheet",3);
blnMajor=Boolean.parseBoolean(strMajor);
adv[iCount].setMajorSheet(blnMajor);
strIntent=JOptionPane.showInputDialog(null,"Does the advisee have the intent to graduate form filed?","Intent To Graduate",3);
blnIntent=Boolean.parseBoolean(strIntent);
adv[iCount].setIntentFiled(blnIntent);
iCount++;
iAccum++;
break;
case "2":
String strUpdateSelection;
String strOutput="";
String strAccumulator="";
System.out.print(iAccum);
for(iCount=0;iCount==iAccum;iCount++)
{
strOutput=adv[iCount].getName();
strAccumulator+=strOutput;
}
strUpdateSelection=JOptionPane.showInputDialog(
null,"~~Please select which advisee's information you need to update~~"+
"\n"+strOutput+
"\nWhat is your selection?","Information Update",3);
break;
case "5":
System.exit(0);
break;
}
}
}
}
Советуйте только опубликовать код, который дает ошибки для всего. И будьте конкретны по поводу вашей ошибки :) –
Что нужно сделать? – Shishigami
Мне нужно, чтобы он прошел цикл и отобразил все пользовательские входы советника. – Treyeyeeyeeye