I have attached a piano man program. (For you guys to understand the program thoroughly, I have also attached the instruction of piano program) Now, I would like you to draw a flow chart of your keyPressed method from the piano man program. From there you will need to put together a table of test inputs including expected and actual results. These results should show a description, but for white box testing might also describe a flow. You need enough test cases to test each branch of the code. Use word document to do it. Thank you! If you have question, just ask me.
pianoman.zip

questionanddescriptio.docx

Unformatted Attachment Preview

You will use the provided code to create a GUI that turns the home row of the keyboard into a
piano.
1. You need to create the GUI interface. I must include a JTextArea called sheetMusic,
three JButtons labeled as record, play, and reset respectively. A label that is used to
give messages to the user, and a label and JTextField that can be used to enter the octave.
2. You will fill in the public String codeToNote(int code) method creating a method that
will accept any keycode and find which note should be played. You should also add the
ability to throw an exception to this method. The following table maps each key to its
note. Any other key should throw an exception with a message stating an incorrect key
was pressed.
Key:
Note:
Integer value (with octave):
A
C
0+12* octave (60 at octave = 5)
S
C#
1+12* octave (61 at octave = 5)
D
D
2+12* octave (62 at octave = 5)
F
D#
3+12* octave (63 at octave = 5)
G
E
4+12* octave (64 at octave = 5)
H
F
5+12* octave (65 at octave = 5)
J
F#
6+12* octave (66 at octave = 5)<-These integer values K G 7+12* octave (67 at octave = 5) are what is passed L G# 8+12* octave (68 at octave = 5) into the method (Semicolon) A 9+12* octave (69 at octave = 5) (Quote) A# 10+12* octave (70 at octave = 5) (Enter) B 11+12* octave (71 at octave = 5) http://www.midimountain.com/midi/midi_note_numbers.html 3. When the record button is pressed the piano will go into recording mode. The label for messages to the user should show that you are in recording mode. During this time when a user presses a key on the home row you will use the keyListeners to have the program will pay the appropriate note and display that note (for example C# not S or 61) in the JTextArea. It will also display the keycode of the key that is pressed and the note in an informative message to a message label. When the number of notes surpasses the value of NUMBER_OF_NOTES value a carriage return will be added to wrap the text to the new line. Use NUMBER_OF_LINES to determine when you are on the last note of the last line. Once that last note has been played on the last line display a message stating that the music has reached its capacity. Once this happens the piano should no longer play sound for keystrokes nor record notes on the sheet music. Before playing this note it will check to make sure that the octave is an integer between 0 and 9 (we will not use the 10th octave). If it is not a message will be shown to the user explaining that there is a mistake with the octave setting and it will not play the note or record it on the sheet music. This should be done through exception handling. If the user enters any other key the program should display to the message label what the key was pressed and a message that no note was played. You will also want to use the keyPressed flag to prevent multiple key readings from holding down a key for an extended time. Each press should only result in one note. 4. When the play button is pressed the piano will no longer record key presses or pay sounds if a key is presses. However it will read the notes from the JTextArea and call the playNote function accurately for each note. 5. The reset button will clear the contents of the JTextArea and then set the piano into recording mode. Throughout your program use try and catch blocks were needed and make sure to nicely comment your code. The playNote(int note) and waitForNote() methods should not be changed. ... Purchase answer to see full attachment