CS 380
User Interface Design
Abbr. Cmds.
David B. Levine
Computer Science Department
St. Bonaventure University
Copyright, 2000, 2002, 2004
Objective
By the conclusion of this lab period, you will have:
1. Gained experience with some of the programming issues surrounding text interfaces and abbreviations.
2. Written a small menu driven program with a more robust user interface than is typical of academic assignments.
Preparation:
Although you don’t need the specific information contained therein to complete this week’s lab, the material in Chapter 8 of the text is again particularly relevant to the lab. Section 8.5 addresses the topics directly, although not from the same perspective as the lab. I also suggest reading the entire lab before beginning the instructions. There is an optional step and your choice about it may influence the steps before or after it. Note that it is only optional to skip the intermediate step per se; your final program must still have the capabilities that it would had you completed that step.
Background
The goal is to create a generalized menu handler for a set of text based commands. In the early steps, the list will be fixed and abbreviations will not be permitted. As you progress, these restrictions will be dropped. Ultimately, you need turn in only the final program, but it is strongly advised that you go through the intermediate steps presented. Doing so will not slow you down appreciably (with the possible exception of Step 3 which is optional), and will make debugging much easier. Students who attack the problem without intermediate steps should expect little or no help with the assignment.
Instructions:
- Write a menu handler similar to last week’s except that it should handle the following six commands (as well as a QUIT command): CANCEL, COPY, COLOR, ERASE, PAINT, and PRINT. As was the case last week, these commands should cause individual functions to be executed, but said functions can just be stubs. Save a backup copy of this program; it may help in Step 3.
- Modify your program so that it handles also any unambiguous abbreviations for the given commands. Thus, PR is for PRINT; ERA is for ERASE; but CO is an error because the user could have wanted COPY or COLOR and there is no way to tell. (It may pay to archive this program for future use.)
- Write a more general version of the program in Step 1. Instead of only working for those five commands, it should take a list of commands from a file (one per line) and handle whatever commands are given therein. Obviously, you won’t have the “stub” functions at this point, but you will want to remember them; you never know when the idea might come in handy. This version of the program does not need to worry about abbreviations. Note that this version of the program will begin by asking the user for the file containing the list of commands. (Okay. I admit it. This is unrealistic. But you will do better next week. I promise!)
- Modify the program from Step 3 to handle unambiguous abbreviations as in Step 2.
- Document your code well (using Javadoc standards), format the code appropriately (right-clicking the code and choosing Source:Format in Eclipse should do), and print it out.
To Hand In:
- You are to hand in a printout of the code generated in Step 4. You should also hand in a printout of a run of the program. (Note that for me to understand it, you will need to print your file of commands and hand that in as well.) Label each document carefully and hand it in along with a cover sheet.
- You are also to create a folder with your names and the suffix "AbbrCmd, e.g. SmithJonesAbbrCmd, place a copy of your .class file in it, and then place the folder in the CS380 subfolder of the ClassUploadFolder on the CSNet server.
Assignment Type (see Academic Practices and Policies Document):
Group assignment, limited collaboration.