Unformatted text preview: Introduction By now you should have completed all ofthe regular chapters in the textbook. We have also completed a simple Fortune Cookie application: however, the fortunes are "hard—coded" into the
application and can't be changed after the program has been compiled (without editing the source and re—compiling). In this next lab. we'll type all the fortunes, one per line. into a new plain text file named FortuneFiledata (but they can be different fortunes, if you like}.
Assignment Read my supplement in the Resources on File Handling and then modify the FortuneCookie program (attached here), saving the new version as FortuneFile.java to read all the fortunes
from the FortuneFiledata ﬁle when the program ﬁrst starts. Pay particular attention to the end of my resource as that tells you everything you need to know to accomplish this. Hints: You'll need to change the name of the ﬁle and the class. You'll need to import some newJaua classes from a newJava package and modify some method headers. The work of
reading the ﬁle, since it only needs to be done once at the beginning of the program, should be in the initialization section. or more speciﬁcally, the loadFortunes method that it calls. ...
View Full Document