COM 1204 Assignment #4. Due: Tuesday, 14 May 2002 Working in teams, you will work on object-oriented design for the program described below. Your team will then implement the program in assignment #5. For assignment #4, you will turn in at least one written scenario, a set of CRC cards, and any other design artifacts that you believe the instructor should consider when grading your scenarios and CRC cards. All members of the team should expect to receive the same grade for each team assignment. Your team's grade for this assignment will be based on the instructor's opinion of the quality of the design, and also on the professionalism of the design artifacts. Spelling and grammar will affect the instructor's subjective impression of professionalism. Collaboration between students on the same team is required, but collaboration between students who are not on the same team is forbidden. You are responsible for keeping your design notes and documents hidden from all students who are not on your team. This assignment is due at the beginning of class on the due date shown above. Please submit a manila envelope or folder that contains your team's design artifacts. On the outside of the envelope or folder, please write the names of all members of the team. Late assignments may be discounted, and very late assignments may be discarded. -------------------------------------------------- The program you are to design is for a guitarist named Jeff who often performs as a soloist. Jeff maintains a repertoire of about one hundred tunes. Jeff desires a computer program that will select any given number of tunes from his repertoire at random. He also wants the computer program to list the selected tunes in an order that would minimize the amount of retuning that Jeff would have to do when performing the tunes in that order. Jeff's repertoire is listed within in a text file (called the database), and the instructor will provide Java code that parses the database and calls a stub routine for each tune in the repertoire. For assignment #5, you should expect to modify the instructor's stub routines to do whatever is needed by your program design. Each tune in Jeff's repertoire will be identified by its name, which will be a non-empty string. Most tunes will have other information associated with them as well, such as the name of the composer (a string), opus (an int) and number (an int), year of composition (an int), and the tuning (see below) that Jeff uses to perform the tune. The only information that appears to be immediately relevant to Jeff's program, however, are the title and tuning. If Jeff's database contains a tune with no explicit tuning, then Jeff performs that tune in the tuning that is considered standard for six-string guitar, which is EADGBE. This sequence of letters names the pitch class that is sounded by each of the guitar's six strings. By convention, the leftmost letter names the pitch sounded by the sixth string, and the rightmost letter names the pitch sounded by the first string. Other tunings are obtained from standard tuning by tuning certain strings up or down some integral number of half-steps. For example, the EADF#BE tuning that Jeff uses on some tunes is obtained by tuning the third string down one half-step, from G to F#. The DADGAD tuning that Jeff uses on some tunes in obtained by tuning the first, second, and sixth strings down two half-steps from standard tuning. The parsing code that is provided by the instructor will represent a tuning as a six-element int array in which each element records the number of half-steps that a string is tuned up or down from standard tuning; zero indicates that the string is tuned to its standard pitch, a positive integer indicates that it is tuned up, and a negative integer indicates that the string is tuned down. Element 0 of the array gives the tuning for the first string, element 1 for the second string, and so on. For example, the DADGAD tuning is represented by an array whose elements are <-2, -2, 0, 0, 0, -2>. The DGDGBbD tuning is represented by an array whose elements are <-2, -1, 0, 0, -2, -2>. The EADF#BE tuning is represented by an array whose elements are <0, 0, -1, 0, 0, 0>. The program takes two command-line arguments. The first is a non-negative integer n that tells how many tunes should be selected. The second is the name of the file that contains the database. The instructor will provide code for parsing these command-line arguments. The output of the program is to be written to System.out. If the input n is negative or is larger than the number of tunes in Jeff's repertoire, then the output should be an appropriate error message. Otherwise the output should be a list of n randomly selected tunes, one per line, with each line giving both the name of the tune and, within parentheses, the tuning as Jeff would like to see it, for example DADGAD. If the tune is in standard tuning, then the tuning can be omitted from the line, and Jeff would actually prefer that the tuning not be printed in that case. It is important that the order in which the tunes are listed minimizes retuning.