I tested all the cases before I started adding bells and whistles to the "new" option
Campbell Ritchie wrote:Add a line like this to display the input: System.out.printf("Input = \u201c%s\u201d%n", input); where you are calling the String in question input. You will get “” around the output.
Shannon Pitts wrote:
ETA: Yeah, I'm using Java 7. I can't imagine how else I'd be able to use the keyboard input to determine what the program does next. I guess it used to be kind of complicated?
Campbell Ritchie wrote:I haven’t got a link to it on this computer, but Google for Java Tutorials file input output and you should find something useful This is one of the hits from that Google search.
Campbell Ritchie wrote:You appear to have two independent problems: One is how to read text from a file, which is best done with a FileReader and a BufferedInputStream, which you will have read about in the tutorial.
The other is how to create an object from the data in your file; that depends on the format of the file and all its information being in the correct order and the correct positions.
Shannon Pitts wrote:Is it possible to open the file, read out the contents and save them into objects, then close the file, then when the program closes, reopen the file to write, write the data, then close both file and program? The only problem I can see is that if the program closes unexpectedly you'll lose any changes to the list since the last save, but I can't think of any other way for the program to have the data persist, besides databases which I'm not quite ready for yet.
You save more money with a clothesline than dozens of light bulb purchases. Tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|