This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I instantiated an obj and passed 6 parameters, they were written to a text file with PrintOut method in Write class. Since A to F are private variables, I use get methods to return their values. So, there is a record of 6 data written to a text file. However, after saving this record, I want the console to ask whether the user wants to input additional record? e.g. System.out.println("Do you want to add more record (Y/N)?"); and it got the "y/n" reply from user. I know how to use BufferedReader console = new BufferedReader(new InputStreamReader(System.in)); to get user input.
However, I do not know where should I put the while/do...while loop as the logic is: Ask the user to input the first record; then Ask the user whether he wants to add more record for continuing input; A while loop seems not feasible. Anyone could propose the algorithm? Thanks a lot Andrew