can someone help me to correct the code? this is the first time i code java program. i've problem with the input for boolean data type, when i insert 'true' or 'false' and enter, it won't jump out. and everytime after i run a menu, it won't return to mainmenu and just jump out from the program.can someone tell me why? thanks a lot. below are part of the code: application.java:
System.out.println("Enter your Choice: "); //allow user to input choice BufferedReader br= new BufferedReader(new InputStreamReader(System.in)); choice = br.readLine();
public static int addNew(Patient[] patientList, int count)throws IOException { int index = 0; String id = ""; boolean found = false; boolean addMore = true;
Patient aPatient; while(addMore){ aPatient = new Patient(); do{ BufferedReader br= new BufferedReader(new InputStreamReader(System.in)); System.out.print("Enter new patient Id: "); id = br.readLine(); System.out.println(); found = search(patientList, id, count); if (found) { System.out.println("Patient Id exists. Please re-enter!"); } }while(found); while(!found){ addMore = aPatient.insert(count, id); if(addMore){ patientList[count] = aPatient; count++; } } } return count; }
patient.java //insert a new patient record public boolean insert(int c, String id) throws IOException { boolean addMore = false; String cont = ""; String str = ""; int inAge = 0; int inWgt = 0; boolean inSmk = false;