Due date details | Overview | Starting code
JavaDoc as a zip (when available) |
Written part | Rules, advice, guidelines Hints, tips, and corrections Please check here occasionally! |
Part A/Part B contents | Turn-in forms |
Due dates: Part A (electronically): 9:00 pm Friday, Jan. 17, paperwork in quiz section Tuesday Jan. 21; Part B (electronically): 9:00pm Wednesday, Jan. 22; paperwork in section Jan. 23. ["Paperwork" as always means the printed electronic receipts, plus any written material (questions, diagrams, etc.) that might have been assigned. Staple all such material together, please.]
Your previous experiment in Computational Theology proved that the gods of luck can be fickle indeed. Fortunately, there are other oracles than can be consulted. Take a comparison-shopping tactic. Try each of several oracles a couple of time, and go with the best result from each of them. Your luck is bound to be good according to one of them.
An oracle takes your question and poses it to the deities, and interprets the answer. The answer, or result, we shall call an omen. In the case of the gods of Luck, the question consisted of your initials, and the omen was the number of tries it took to match your initials.
At the local Mall of the Gods, there are a variety of temples where you can consult an oracle.
Task: Implement a program which takes a string (the request) from the command line. The string is presented three times each to the three different oracles. The result of each trial is briefly reported, and the trial which is most favorable is reported in possibly more detail.
The task is structured to give you practice with implementing interfaces, and using objects which implement the interfaces. There will also be continued practice with arrays, strings, and packaging.
This specification is not complete by itself. You will need to read all the supplied code carefully, especially the comments. You should also refer back to the Project 0 description for general background.
All code, unless otherwise noted, belongs in a package named project1. To avoid Bluej problems, you are encouraged to create the directory and place files in it before creating your Bluej project. Don't let Bluej "fix" anything.
A P1Main class invokes the three oracles and reports the results. You will not be able to turn in a modified version of this .java file. Study it carefully, however, for clues about completing the assignment successfully. (Re-posted with correction 1/15).
An interface IOracle is defined, with methods that every oracle must implement. Likewise, there is an interface IOmen for the omens returned. You won't be able to turn these files in, but they are crammed with useful comments. Each oracle type has its own unique omen type. Because the oracles are invoked in main, their names are baked into the program, and unfortunately can't be changed. The oracles, each of which you must implement as a class in a separate .java file, are LuckTester, LuckyOccurrenceCounter, and TextSearcher. For each oracle, implement an omen class; names of the omen classes are up to you, because they do not occur in any of the supplied code. There is a TextSearcherUtils class containing one method to read a file (you can't change or turn in this file); a brief starter class for TextSearcher is given to show how to use that method. Text Searcher reads a sacred text which must be downloaded and copied into your project (try putting the file in the project1 package directory. If this doesn't work, place a copy in the directory above.)
In additional, there is a partially implemented class called Utilities. It contains an uncompleted method used by the main class. For your program to work properly, implement that method and turn it in.
You can (and probably should) use any of the code you wish from the sample solution to Project 0 (see the main Homework page).
Some rules (for this project):
Some advice:
At this point in the course, a number of style or programming practice issues have been mentioned in class. You have also seen examples of our code. Let these be reference points for the style you use. It is overall clarity, consistency, and ability to communicate to the human reader that matters most, so don't agonize unnecessarily over details that don't contribute to those goals. (We will at some point ask you to be a bit pickier about details, by the way).
Part A specifics: Turn in all required classes, such that they compile without error on the turn-in server, and such that the resulting program executes without blowing up when run from the command line with the argument "UW". The program does not even have to produce any sensible output, or really do anything at all! But it must run to normal completion. Also turn in written part I with the paperwork for Part A.
Part B specifics: Turn in the classes again, such that the resulting program, executed on our servers, operates correctly in all cases. The program should never abort, even if garbage input is supplied.
Please read the turn-in forms carefully when they become available, including the fine print! After submitting a form, read what comes back, too. PLEASE make sure that you use the correct form for each part!! | Part A Turn-in form | Part B Turn-in form |
Buona Fortuna!
Hints, Tips, and Corrections
A bug in P1Main was fixed Wed. Jan 15, 8:45. Please grab a new copy of P1Main and copy it into your project. Details of the error, from the Message Board: |
Date: 01/14/2003, 22:25 I believe there is an error in the invokeTheOracle method of the P1main
class. At line 89, it says: |
Date: 01/15/2003, 8:27 You're right! [trialsToRun-1] should have been either [trialsToRun-t] or just
[t-1]. I'll put up a new version of P1Main later. |
|
Date: 01/15/2003, 8:53 OK, it's fixed. You probably want to download a new version of P1Main. Since
we'll use the updated version, if your program is correct (specifically,
chooseBestOmen), it will give the right best omen when we run it, even if you
choose not to download the new version. You just won't be able to test as
easily. |
Rule 2: "You may not define additional .java files. " This rule was inherited from Project 0, and needs to be overridden. Previous parts of the instructions have already required 3 .java files for the oracles, and probably 3 more for the omens. The turn-in form will have a number of additional slots that you can use for optional .java files.