Some of the potential enhancements you may be making to the basic system during the semester:
A friendly word of advice: in the design of this extension, think ahead to later when you will be implementing a GUI interface to PSAE. Try to implement this extension in terms of a common API to both the CLI user interface and the GUI user interface.
Here are the specific requirements for this project.
The -answer argument takes two parameters: a string indicating the title, and a single integer indicating which answers the user indicated to be correct.
If the supplied string does not exactly match any of the loaded :TITLE strings, then the program should provide an informative error message and terminate execution. (Note that the entire set of loaded questions are searched, not just those in the current selection set as specified by the -diffSet command.)
The integer argument to -answer encodes which answers the user indicates to be correct in the following way. Assign the value 1 to the first :ANSWER declaration for the indicated question. Assign the second :ANSWER declaration the value 2. Assign the third :ANSWER declaration the value 4. And so on--the nth answer gets the value 2**n-1.
To determine the set of answers checked as valid, you sum the values. Thus, the integer value 0 indicates that no answers were checked. The integer value 1 indicates that only the first answer was checked. The integer value 3 indicates that the first two answers (1+2) were checked. The integer value 7 indicates that the first three answers were checked (1+2+4) were checked. The integer value 6 indicates that the second and third answers were checked (2+4). And so on.
If you think about this numeric encoding for a little while, you should be able to come up with a simple algorithm that enables you to test this integer against the answer set and determine what's correct and what's not correct.
More than one -answer argument can be provided on the same command line.
If there are only two answers for the given question, then the possible legal integer values are 0, 1, 2, and 3. Any other integer values should be considered as a command line error in this case. In general, for a question with n answers, the possible legal integer values range from 0 to (2**n) - 1.
The program should print out a single line in response to each -answer argument. The line should specify the title of the question being tested, and the amount of credit awarded for that question. Credit should be awarded in the following way:
% java -jar johnson-P3.jar -qa test.qa -answer "Question01" 1 Personal Self-Assessment Environment V3.0 Philip Johnson Loading question title: Question01 Loading question title: Question02 Loading question title: Question03 Loading question title: Question04 Loading question title: Question05 Loading question title: Question06 Loading question title: Question07 Loading question title: Question08 Loading question title: Question09 Loading question title: Question10 10 questions successfully loaded. Answering 'Question01': 100
% java -jar johnson-P3.jar -qa test.qa -answer "Question01" 1 -answer "Question03" 4 Personal Self-Assessment Environment V3.0 Philip Johnson Loading question title: Question01 Loading question title: Question02 Loading question title: Question03 Loading question title: Question04 Loading question title: Question05 Loading question title: Question06 Loading question title: Question07 Loading question title: Question08 Loading question title: Question09 Loading question title: Question10 10 questions successfully loaded. Answering 'Question01': 100 Answering 'Question03': 100
% java -jar johnson-P3.jar -qa test.qa -answer "Question01" 1 -answer "Question03" 7 Personal Self-Assessment Environment V3.0 Philip Johnson Loading question title: Question01 Loading question title: Question02 Loading question title: Question03 Loading question title: Question04 Loading question title: Question05 Loading question title: Question06 Loading question title: Question07 Loading question title: Question08 Loading question title: Question09 Loading question title: Question10 10 questions successfully loaded. Answering 'Question01': 100 Answering 'Question03': 0
Note that other command line arguments could also be supplied.