public void printCustomer(){ int iSize=customerList.size(); boolean loopControl=true; String answer=""; while(loopControl){ int loop; Customer cusTemp; System.out.printf("Which Customer is Ordering ?\n"); for(loop=0;loop<iSize;loop++){ cusTemp=customerList.get(loop); System.out.printf("% 2d. %-20s \n",loop+1,cusTemp.getName()); } answer=keyboard.nextLine(); int index=Integer.parseInt(answer)-1; if(index<iSize){ tempCustomer=customerList.get(index); loopControl=false; } else{ System.out.printf("\n Sorry, wrong option."); } } }
keyboard
Scanner keyboard=new Scanner(System.in);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)